Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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}

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 musing on the Monastery: (4)
As of 2016-10-28 02:44 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (374 votes). Check out past polls.