W
Wolfgang
Being familiar with other programming languages, I had assumed that
only the very last input line would be printed by the code below. I
was thinking that because the print statement is outside the 'while'
loop.
$x = "";
while (<>) {
$x .= $_;
}
print $x . "\n";
Why does this code print all input lines?
Thanks,
Wolfgang
while (<>) { $x .= $_; } print $x . "\n";
only the very last input line would be printed by the code below. I
was thinking that because the print statement is outside the 'while'
loop.
$x = "";
while (<>) {
$x .= $_;
}
print $x . "\n";
Why does this code print all input lines?
Thanks,
Wolfgang
while (<>) { $x .= $_; } print $x . "\n";