Is it not possible to use $_ in subroutines?
For example, my temptation was to do this:
**************************************
sub isDate {
$_ = shift;
if (m!\d{2}/\d{2}/\d{2}!) { return 1; }
else { return 0; }
}
**************************************
... but by modifying $_ I was clobbering $_ elsewhere in the larger program!
Oddly, perl won't let me do "my ($_) = shift;", so I'm stuck having to use
another variable.
Why can't we do that? Is using $_ in subroutines discouraged??
TIA.
- Bryan
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/