Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^3: Why should I use perl 5.10?

by shmem (Canon)
on Dec 01, 2007 at 16:47 UTC ( #654342=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Why should I use perl 5.10?
in thread Why should I use perl 5.10?

The qw() operator provides list context already. So

print ( qw(a b c) x 3 );

yields the same result as

@l = qw(a b c); print ( (@l) x 3);

which makes sense imho. An array isn't a list, but a qw() expression is.

update: as a reminder, this is from perlop:

Binary "x" is the repetition operator. In scalar context or if the left operand is not enclosed in parentheses, it returns a string consisting of the left operand repeated the number of times specified by the right operand. In list context, if the left operand is enclosed in parentheses or is a list formed by "qw/STRING/", it repeats the list. If the right operand is zero or negative, it returns an empty string or an empty list, depending on the context.


_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Comment on Re^3: Why should I use perl 5.10?
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2015-11-28 19:25 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (744 votes), past polls