reference - regarding usage of arrow notation in perl -
i've following 2 statements written in perl :
@m1 = ( [1,2,3],[4,5,6],[7,8,9] ); # array of references. $mr = [ [1,2,3],[4,5,6],[7,8,9] ]; # anonymous array. $mr holds reference.
when try print
:
print "$m1[0][1]\n"; # statement outputs: 2; expected. print "$mr->[0][1]\n"; #this statement outputs: 2; expected. print "$mr[0][1]\n"; #this statement doesn't output anything.
i feel second , third print statements same. however, didn't output third print statement.
can let me know wrong third print statement?
this simple. $mr
reference. use arrow operator
dereference.
also, if use use warnings; use strict;
, have received obvious error message:
global symbol "@mr" requires explicit package name
Comments
Post a Comment