Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Constants lists in array slices

by LanX (Saint)
on Jul 20, 2018 at 12:25 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-16 15:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found