in reply to Very curious Problem...
> Why $_ is changed??
while(<STATUS>) sets $_ (see perlop ¹) and $_ is global.
Maybe you rather wanna use:
while (my $line = <STATUS>)
Cheers Rolf
UPDATE
¹)
The following lines are equivalent:
while (defined($_ = <STDIN>)) { print; } while ($_ = <STDIN>) { print; } while (<STDIN>) { print; } for (;<STDIN>;) { print; } print while defined($_ = <STDIN>); print while ($_ = <STDIN>); print while <STDIN>;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Very curious Problem...
by anaconda_wly (Scribe) on Jan 23, 2013 at 09:38 UTC | |
by LanX (Saint) on Jan 23, 2013 at 10:17 UTC | |
by Anonymous Monk on Jan 23, 2013 at 10:21 UTC | |
Re^2: Very curious Problem...
by anaconda_wly (Scribe) on Jan 23, 2013 at 09:18 UTC |
In Section
Seekers of Perl Wisdom