On 2011-11-25 10:50, timothy adigun wrote:
Mike D<ekimduna...@gmail.com> wrote:
# this function expects an array to be passed by reference
sub foo
{
my ($thing1) = @_; # make a lexical variable for the array being passed
Fine, but since you are getting a reference, I don't really think you need
the "()"
around $thing1, which gives a list context, with one element.
Better put:
my $thing1=shift @_;
I consider that ill advice.
my ( $thing1 ) = @_;
is (for example) a good way to show that you are currently only using
the first parameter.
Use 'shift' only when you need to change the shape of @_.
Which you should almost never need.
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/