Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Clever map / foreach algorithm sought

by Sidhekin (Priest)
on May 03, 2002 at 14:02 UTC ( #163787=note: print w/replies, xml ) Need Help??


in reply to Clever map / foreach algorithm sought

Anything can be done on one line ... if the line is just long enough. Possibly you are looking for something like this:

my @x = (4, 4, 2); my $pref = 'XX'; my @y = map {my $chunk=$_; map{sprintf("$pref%02d:",$chunk).$_}1..$x[$ +chunk-1]}1..@x;

The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2022-05-26 05:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (93 votes). Check out past polls.

    Notices?