On 10-12-03 10:36 AM, Odin Liu wrote:
Suppose file test.pl is:
my @ins = @ARGV;
foreach(@ins) {
open IN, $_;
# the three argument open is preferred. See `perlodc -f open`.
open my $in_fh, '<', $_ or die "could not open $_: $!\n";
while(<IN>) {
while( defined( my $line = <$in_fh> )){
chomp;
print "@ins\n";
}
close IN;
close $in_fh;
}
You are using $_ twice. The second time overwrites the first, thus
changing @ins
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
The secret to great software: Fail early & often.
Eliminate software piracy: use only FLOSS.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/