Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: comments and qw

by bsb (Priest)
on Feb 13, 2006 at 09:47 UTC ( [id://529768]=note: print w/replies, xml ) Need Help??


in reply to comments and qw

You could play bareword roulette:
use strict; no strict 'subs'; do_something($_) for ( foo, # comment bar, baz, );

Replies are listed 'Best First'.
Re^2: comments and qw
by Roy Johnson (Monsignor) on Feb 13, 2006 at 15:44 UTC
    You could also use => to effectively qw all the list members. (I use keywords here to show that there's no roulette being played. They're interpreted as strings.)
    do_something($_) for ( exit => # comment sub => exec => do_something => # It's a string here, not a sub call! ); sub do_something { print "Got ($_[0])\n"; }
    Keep in mind that qw and => have somewhat different rules about what they quote: qw effectively quotes each run of non-whitespace; => quotes only runs of "word" (alpha-num-underscore) characters, and interprets everything else.

    Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-28 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found