in reply to these aren't locals, but they seem to act like it
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: these aren't locals, but they seem to act like it
by argv (Pilgrim) on Mar 12, 2007 at 15:27 UTC | |
by mreece (Friar) on Mar 12, 2007 at 16:30 UTC | |
by sgifford (Prior) on Mar 12, 2007 at 16:43 UTC |