invoke a subroutine indirectly via glob references

4 views
Skip to first unread message

Rainer Weikusat

unread,
Jan 4, 2022, 11:17:44 AM1/4/22
to
Assuming that an array element $l[0] holds a reference to a glob, the
subroutine currently associated with this glob can be invoked via

*{$l[0]}->(1, 2, 3)

with an explicit argument list or as

&{*{$l[0]}}

with the current @_.

The idea behind this is that the subroutine associated with the glob
might change in future and that the expression should then invoke the
'current' function and not the old one.



Reply all
Reply to author
Forward
0 new messages