develooper Front page | perl.beginners | Postings from February 2002

Re: Arrays 1x3 or 3x1 - The real questions

Thread Previous | Thread Next
Jeff 'japhy' Pinyan
February 12, 2002 14:06
Re: Arrays 1x3 or 3x1 - The real questions
Message ID:
On Feb 12, Steven M. Klass said:

>&Somefunction($var1, \@arry)
>sub SomeFunction {
>	my $var = $_[0];    # XXX you were missing a ; here
>	my $array = shift;

Uh, $array and $var have the same value now.  shift() removes the first
element from an array (defaulting to @_) and returns it.  The first
element of @_ is $_[0], which is $var1.


  my $var = $_[0];

is not the same as

  my $var = shift;

The first one does NOT remove the element from @_; the second one DOES.

Jeff "japhy" Pinyan
RPI Acacia brother #734
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About