in reply to Re^2: A question on array references.
in thread A question on array references.
That's because each element is a string now but if you also want to index individual words then make the data structure a reference to an array of arrays by using square brackets around each qw{ ... }.
knoppix@Microknoppix:~$ perl -Mstrict -wE ' > my $refArr2 = [ > [ qw{ this is the first line } ], > [ qw{ Second one is here } ], > [ qw{ squint your eyes to see the third } ], > [ qw{ fourth is surely near } ], > ]; > > say $refArr2->[ 1 ]->[ 0 ]; > say qq{@{ $refArr2->[ 1 ] }};' Second Second one is here knoppix@Microknoppix:~$
I hope this is helpful.
Cheers,
JohnGG
|
|---|