On Sat, Apr 19, 2008 at 6:08 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
>  sub process_it {
>     my($variable, $hash_table) = shift;
>
>  }
>
>  when I change to separate shift
>
>  my $variable = shift;
>  my $hash_table = shift;
>
>  it worked...   are they different?
snip

Yes, shift returns one item from the array it is working on, so the
first is like saying

my ($variable, $hash_table) = 5;

$variable will be 5 and $hash_table will be undefined.  To get what
you want you must either say

my ($variable, $hash_table) = (shift, shift);

or the two statements you already used.  If you do not need to remove
the values from @_ you can always say

my ($variable, $hash_table) = @_;

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

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


Reply via email to