in reply to WHILE and DEFINED problem
The idiomatic way to write that is:
local @ARGV=qw(c:/tmp.txt); while (<>) { chomp; print "\$_: '$_'\n"; }
And its easier to get right too. ;-)
Update after a moments reflection: My point being that no its not better to use defined, or any of the other common pieces of advice about avoiding perl idiom. The idiom exists to make your life easy and to reduce trivial and common coding errors. If you want to have to hassle with stuff like that then do it in C.
Update 2: Read the link valdez posted. ++ to him. Obviously its clear which camp im in, but I can see there are good points raised in that thread about using defined(). I still wouldnt though.
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|
|---|