|
Re: On using $_ in subroutines: msg#00365perl-beginners
Bryan Harris wrote: ... but by modifying $_ I was clobbering $_ elsewhere in the larger program! 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-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |