You might like to consider accessing the parameters using the hash. When you start using Perl's OO features you will find that that is standard technique anyway. Consider:
use strict; use warnings; foo( "hi", "apoinv", "slkjhfp", "876", "poi", "asdf", "sdf", "there" ) +; print "\n"; foo( { flags => "hi", img => "apoinv", name => "slkjhfp", big => "876", gallery => "poi", page => "asdf", caption => "sdf", num => "there" }); sub foo { my %args; if (ref $_[0] eq "HASH") { %args = %{$_[0]}; } else { @args{qw(flags img name big gallery page caption num)} = @_; } print "$_:\t$args{$_}\n" for sort keys %args; }
Prints:
big: 876 caption: sdf flags: hi gallery: poi img: apoinv name: slkjhfp num: there page: asdf big: 876 caption: sdf flags: hi gallery: poi img: apoinv name: slkjhfp num: there page: asdf
In reply to Re: these aren't locals, but they seem to act like it
by GrandFather
in thread these aren't locals, but they seem to act like it
by argv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |