Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^2: Print a string X times?

by targetsmart (Curate)
on Aug 04, 2010 at 07:45 UTC ( #852817=note: print w/ replies, xml ) Need Help??

in reply to Re: Print a string X times?
in thread Print a string X times?

in the statement print +('-') x $length , "\n";

the +('-') does some magic which I don't understand, could you please explain that statement..

-- 'I' am not the body, 'I' am the 'soul/consciousness', which has no beginning or no end, no attachment or no aversion, nothing to attain or lose.

Comment on Re^2: Print a string X times?
Select or Download Code
Replies are listed 'Best First'.
Re^3: Print a string X times?
by pid (Monk) on Aug 04, 2010 at 08:27 UTC

    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."

Re^3: Print a string X times?
by GrandFather (Sage) on Aug 04, 2010 at 09:35 UTC

    Try removing the + and ensure you use strictures (well, warnings anyway) and see what happens.

    True laziness is hard work

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2015-12-01 16:14 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (18 votes), past polls