Correct, but fails memory restriction. (makes an array with O(2**LEN) elts, where LEN is the length of the output string). Will FAIL the test script, but is interesting to watch output for small values (length < 10).
#!perl
map{@;=map{($ARGV[$|--])x$_}@;,@;;print}@;=1..pop,$/
|
#!perl
map{@;[0..@;]=map{($ARGV[$|--])x$_}@;,@;;print}@;=1..pop,$/
|