http://www.perlmonks.org?node_id=163787


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)},"