On Sat, 07 Sep 2013 14:15:39 +0200
"Dr.Ruud" <rvtol+use...@isolution.nl> wrote:

> On 07/09/2013 13:43, Karol Bujaček wrote:
> 
> >    print Dumper(@_);        # just look how the @_ looks like
> 
> Consider: print Dumper( \@_ );
> 
> 
> >    my($animals, $digits) = @_;
> >
> >    my @animals = @$animals; # dereference
> >    my @digits = @$digits;   # dereference
> 
> The comment is inaccurate.
> 
> Why would you want to copy the arrays?

So you could can their contents without the contents of the arrays in
the caller being changed.

> 
> 
> >    print Dumper(@animals, @digits); # just look ...
> 
> Consider: print Dumper( $animals, $digits );
> 
my @pets = ('dogs' , 'cats' , 'horses');
my @numbers = (1..10);
 
my_study (\@pets , \@numbers);

sub my_study {
    my @animals = @{ shift @_ };
    my @digits  = @{ shift @_ };

# code for sub my_study
}

-- 
Don't stop where the ink does.
        Shawn

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to