John W. Krahn wrote:
Chad Perrin wrote:
On Fri, Apr 21, 2006 at 12:48:51PM -0700, John W. Krahn wrote:
print/.*/g,$"while<>
Yeah, that's it.
Woah, that's pretty short.
You can make it even shorter:
print/.*/g,$"for<>
They aren't quite the same though. 'while' loops if the condition is
still true (scalar context). 'for' loops if there are more items in the
array (array context).
while (<>) gets a little extra magic than just the normal <>.
while (<>) is the same as while (local $_ = readline (ARGV))
for (<>) is the same as for (readline (ARGV))
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>