in reply to How to dereference array of ref.s?

Hello nikolay

you can dereference using braces and prepending the right sigyl;  print ${ $a[0] }

Standard doc is perlref

Your array element is just a plain scalar and you must learn just how to derefence a sclar. Infact is the same of:  my $ref = \'qwerty'; print ${ $ref }

If no confusion is possible, as in my second example, you can dereference without braces like in  print $$ref or using postfix dereference  use feature 'postderef'; my $ref = \'qwerty'; print $ref->$* but see the above docs for versions of perl that have this feature enable or usable.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: How to dereference array of ref.s?
by haukex (Archbishop) on May 20, 2018 at 18:14 UTC
    versions of perl that have this feature enable or usable

    The Postfix Dereference Syntax is enabled by default in Perl 5.24 and above. E.g. on v5.26:

    $ perl -wMstrict -e' my $q="qwer"; my @a=(\$q); print $a[0]->$*,"\n";' qwer

    However, if you want it to interpolate in strings, you do need to enable the postderef_qq feature, for example via the v5.24 feature bundle ("use 5.024;"):

    $ perl -wM5.024 -e' my $q="qwer"; my @a=(\$q); print "$a[0]->$*\n";' qwer
Re^2: How to dereference array of ref.s?
by nikolay (Beadle) on May 20, 2018 at 15:00 UTC
    Thank you! Awesome!