Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Constants lists in array slices

by LanX (Sage)
on Jul 20, 2018 at 12:25 UTC ( #1218894=note: print w/replies, xml ) Need Help??


in reply to Constants lists in array slices

answering my own question:

Testing with 5.24 shows constant folding of lists to work:

X:\>perl -MO=Deparse -e"use constant L=>1,2,3; print @a[L]" use constant ('L', 1, 2, 3); print @a[1..3]; -e syntax OK

seems like constant folding of lists was only added "some years" ago. ;-)

update

for comparison 5.18

D:\>perl -MO=Deparse -e"use constant L=>1,2,3; print @a[L]" use constant ('L', 1, 2, 3); print @a[L()];

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1218894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2022-08-09 22:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?