in reply to Uninitialized string warning

Hi Richard,

I am not certain of the exact reasons, but I did have the same problem myself once, and it boils down to:

The automatic initialization of $_ happens only if the while loop looks like while (<>)

Anything else fouls it up. e.g.
This works

# ctrl -c to exit (this is only example code!!!) while (<>) { print "\$_ = <$_>\n"; }
e.g.
This does not work
# ctrl -c to exit (this is only example code!!!) while (<> and 1) { print "\$_ = <$_>\n"; }

Replies are listed 'Best First'.
Re^2: Uninitialized string warning
by VSarkiss (Monsignor) on May 11, 2005 at 20:36 UTC