I'm currently massivly confused by multidimensional arrays and passing arrays to subs.

Why is it that @_[1] isn't properly copied to @a?

I'm not sure what exactly I'm doing wrong here, probably something simple, but I can't find anything that works in the manpages or on the site...

Music($var1, [EMAIL PROTECTED]);

sub Music
{
  print $_[1][1];  # works
  my @a = @_[1] # Gives warning, should be written as $_[1]

  print $a[1]; # Outputs ARRAY(#memaddr)
  print $a[1][1]; # Works

  for (@a)
  {
    print;  # Outputs ARRAY(#memaddr)
  }

  for (@_[1])
  {
    print; # Also outputs ARRAY(#memaddr)
  }
}

--
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