Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Converting python list range expressions to perl

by rsFalse (Chaplain)
on Dec 06, 2022 at 14:40 UTC ( [id://11148611]=note: print w/replies, xml ) Need Help??


in reply to Converting python list range expressions to perl

Possible transforming:
my @a = 'a' .. 'g'; my $py_range = <>; # '[x:y]' my $perl_range = $py_range =~ s{\[:}{[0:}r =~ s{:\]}{:0]}r =~ s/:\K-?\ +d+/$&-1/er =~ s/-\d+/$&+@a/ger =~ s/:/../r; print eval '@a' . $perl_range;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148611]
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: (5)
As of 2024-03-28 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found