in reply to Dereferencing a reference to a typeglob?
"...use v5.24;..."
"Dereferencing a reference to a typeglob" can be done with Postfix Dereference Syntax (i.e. $globref->**). Some examples:
$ perl -v | head -2 | tail -1 This is perl 5, version 24, subversion 0 (v5.24.0) built for darwin-th +read-multi-2level $ alias perle alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -E' $ perle 'use 5.024; my $x = \*STDERR; say "OUT"; say { $x->** } "ERR"' OUT ERR $ perle 'use 5.024; my $x = \*STDERR; say "OUT"; say { $x->** } "ERR"' + > /dev/null ERR $ perle 'use 5.024; my $x = \*STDERR; say "OUT"; say { $x->** } "ERR"' + 2> /dev/null OUT $
I wrote a fair amount about using this syntax in general, just yesterday: "Re^3: Syntax Question Related to "join" on a Complex Data Structure [postderef and postderef_qq]". You'll find examples of "$arrayref->@*", which may be closer (than "$globref->**") to the type of thing you're after.
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dereferencing a reference to a typeglob? [Postfix Dereference Syntax]
by stevieb (Canon) on Oct 29, 2016 at 14:53 UTC | |
by LanX (Saint) on Oct 29, 2016 at 15:08 UTC | |
by kcott (Archbishop) on Oct 30, 2016 at 01:05 UTC |