>
>I thought about using a hash instead of a list of variables.
>
>
>example_sub (
>       {
>               some_scalar => $some_scalar,
>               some_hash_ref => $some_hash_ref,
>               some_string => 'some string',
>       }
>);
>
>So I could add to it any way I wanted and write them in any order.
>
>Any better suggestions?


I also think this is the best way for your purpose.You can pass a hash ref to 
subroutine,and store any arguments you want to be past to the subroutine in 
that hash.

my $hash_ref = {  'arg1' => 'value1',
                            'arg2' => 'value2',
                            ...
                         };
mysub ( $hash_ref );

sub mysub {
   my %arguments = %{+shift};
   ...
}




--
Books below translated by me to Chinese.
Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to