in reply to accessing an anonymous array
I am sorry to say that "anonymous array" is actually a misnomer. It's not an array, it's a reference to an array.
These two snippets are actually equivalent:
andmy $r = ['a', 'b', 'c'];
my $r; { my @a = ('a', 'b', 'c'); $r = \@a; }
So when you try using \[1] to get a reference to the anonymous array, you're ending up with a reference to an array reference.
Drop the backslashes n front of the open square brackets: you don't need them. And start to work it out from there.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: accessing an anonymous array
by haukex (Archbishop) on Apr 13, 2020 at 10:14 UTC | |
by bart (Canon) on Apr 13, 2020 at 19:12 UTC |
In Section
Seekers of Perl Wisdom