in reply to
Print a string X times?
This is my personal favorite:
local $, = ' ';
print +('-') x $length,"\n";
the +('-') does some magic which I don't understand, could you please explain that statement..
From perlop: Symbolic Unary Operators:
"Unary "+" has no effect whatsoever, even on strings. It is useful syntactically for separating a function name from a parenthesized expression that would otherwise be interpreted as the complete list of function arguments."
Try removing the + and ensure you use strictures (well, warnings anyway) and see what happens.
That's really usefull!
++ for that!
A Programming Language, 1962
Programming the 1900 series in COBOL, 1974
Algorithms + Data Structures = Programs, 1976
The C Programming Language, 1978
System V - Interface definition, 1986
Z80 Assembly Language Programming, 1979
TheSOURCE User's Manual, 1979
The C Primer, 1983
Interactive Fortran 77, A Hands on Approach, 1984
Perl.1 man page, 1991
Results (358 votes),