in reply to Simple file to array

require 5.006; # needs recent perl for three-argument open my $infile = 'addys.txt'; my @email_addys; { # enter new scope # create a filehandle visible in the current scope local *FH; # open the file for reading, die on errors # three-argument open is safer than two-arg -- # it safely handles filenames that begin with '<', '>', etc. open( FH, '<', $infile ) or die "Couldn't open $infile: $!" ; # process the file, line by line # <> returns undef at EOF, and the loop ends while( defined(my $line = <FH>) ) { chomp $line; # append the current line from the file to an array push @email_addys, $line; } # close the filehandle, processing is complete close( FH ); } # exit scope # FH is not visible here.
while damndirtyape's example may be more idiomatic, this one uses less behind-the-scenes magic-- i think it's a bit easier for a newbie to understand (and it's safer.)

see open, die, perlop, and perlvar for more details.

good luck!

~Particle *accelerates*