On 9/6/05, Jayvee Vibar <[EMAIL PROTECTED]> wrote: > How do you name subroutine reference parameter in perl? > Naming a local or pass by value is by simply using my ($param1, $param2) = > @_ ; > How about by reference? I think it would be harder if I'll be using $_[0], > $_[1] direct method. > Is it possible?
Those are two separate questions... you can name function parameters like so: sub myfunc { my %args = @_; if ($args{debug}) { print "debug!\n"; } # ... } myfunc(debug => 1, foo => 'bar'); And you can pass by reference by using, er, references. #!/usr/bin/perl use strict; use warnings; use Data::Dumper; sub nosoup { my %args = @_; if (defined $args{soupline} and ref $args{soupline} eq 'HASH') { if (defined $args{nosoupfor}) { delete $args{soupline}{$args{nosoupfor}}; } return $args{soupline}; } else { return (); } } my %soupline = (fred=>1,dave=>2); print Dumper(\%soupline); nosoup(soupline => \%soupline, nosoupfor => 'dave'); print Dumper(\%soupline); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>