Yeah, and since $_ can get silently overwritten (especially as you add code and forget that you were counting on $_) I really hate to use it. Instead, I assign everything to my own variables:
use strict; use warnings; while (1) { my $foo = <STDIN>; $foo =~ m/./ and print "success.\n"; # ... (more code) ... }
I'd also tend not to use a while(1) loop but that's a whole other Oprah.
In reply to Re: <STDIN> not initializing $_
by wade
in thread <STDIN> not initializing $_
by carol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |