logo       

Reading a list of numbers into an array: msg#00326

perl-beginners

Subject: Reading a list of numbers into an array

Hello there, I'd like to read a file thet is a list of numbers like:
3084
4855
2904
making each line (each number) one of the elements of the array. I've tried
foreach my $line (<FILEHANDLE>){ push (@array, $line) }
but then printing the array just gives me the last number, in this case
"2904".
What's wrong?

Thanks
Emanuele
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise