[Edinburgh-pm] Parameter passing, seeking an answer....
Murray
perl at minty.org
Thu Sep 6 01:32:44 PDT 2007
On Thu, Sep 06, 2007 at 08:49:54AM +0100, Ian Stuart wrote:
> my $self = shift;
> my ($self) = @_;
In the above case, one less character.
my ($foo, $bar, $baz) = @_;
my ($foo, $bar, $baz) = (shift, shift, shift);
Much shorter. You can also have:
my ($foo, $bar, @moo) = @_;
But note that:
my (@foo, $zoo, $bat) = @_;
Is probably not what you want because @foo will suck up everything,
leaving $zoo and $bat undef.
More information about the Edinburgh-pm
mailing list