in reply to Print a string X times?

And of course, there's
print '-' for 1..$length;

Previously mentioned "x" should be a bit faster at the cost of more memory.

Replies are listed 'Best First'.
Re^2: Print a string X times?
by Skeeve (Parson) on Aug 05, 2010 at 05:44 UTC

    Or let's go for some obfuscation:

    perl -e 's;^$;sprintf"%80s",$/;e;y; ;-; ;print'

    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e