Bryan Harris wrote:
... 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??
The use of $_ in subroutines is discourage since its name gives no hint
as to what it contains. Always try to choose meaningful names for your
variables. However, if you want to use it, create a local copy.
sub isDate {
local ( $_ ) = shift;
See `perldoc -f local` for details.
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
Regardless of how small the crowd is, there is always one in
it who has to find out the hard way that the laws of physics
apply to them too.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/