title: How to use Email::Address to extract emails from a file with perl
body: <pre><code>#!/usr/bin/perl
  #Author Leo
  use Email::Address;
  
  #use strict;
  my $file = "/var/log/maillog";
  my $string="msgif";
  open(MAIL, $file);
  my @buffer =&lt;MAIL&gt;;
  close(MAIL);
  my $lines=grep(/$string/, @buffer);
  
  #print "@lines";
  
  my @addresses = Email::Address-&gt;parse($lines);
  print $addresses[0]-&gt;address;
  </code></pre>
  
  <p>This is my code. I am new to perl I want to know how I can use <code>Email::Address</code> to parse lines in a file and then get the email address.</p>