Think about Loose Coupling | |
PerlMonks |
Re(2): What Is 'my' Interested In?by Ovid (Cardinal) |
on Jan 30, 2004 at 15:56 UTC ( [id://325263]=note: print w/replies, xml ) | Need Help?? |
Thanks for the kind words. The my trick is an old one that relies on a feature of my that is not documented in perldoc -f my (though my is so ubiquitous that I suspect many people have not even read that perldoc). You see, my, like most Perl functions, has a return value. It returns variable it's declaring. That allows you to do stuff like this:
You can also use it to assign values to more than one variable: perl -MData::Dumper -e 'my @a = my ($x,$y,$z) = localtime;print Dumper \@a'In short, were it not for this feature, Perl would lose many nifty timesavers. Cheers, New address of my CGI Course.
In Section
Cool Uses for Perl
|
|