in reply to hash keys from another file
my @dev; while(<DEV>){ chomp; @dev = <DEV>; }
This almost certainly does not do what you want.
In the while(<DEV>) it reads a line from the file, in the chomp; line it removes the trailing newline, and then in the line @dev = <DEV> it ignores the read line, and reads all the rest of the lines into the array. Without any newline removal.
What you probably meant to write was
while (<DEV>) { chomp; push @dev, $_; }
Or even simpler:
my @dev = <DEV>; chomp @dev;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: hash keys from another file
by Ninke (Novice) on Mar 23, 2013 at 13:03 UTC | |
by Laurent_R (Canon) on Mar 23, 2013 at 22:43 UTC |
In Section
Seekers of Perl Wisdom