in reply to Re: qw() problem
in thread qw() problem

HI,

careful with those comma's:

perl -e '@a = qw(a, b, c);map { print "$_\n"; } @a'

gives:

a, b, c

While:

perl -e '@a = qw(a b c);map { print "$_\n"; } @a'

gives:

a b c

With qw you can skip the comma...

UPDATE: sorry for the spelling mistake. It's commas! I've been reading slashdot too much lately.

--
if ( 1 ) { $postman->ring() for (1..2); }

Replies are listed 'Best First'.
Re^3: qw() problem
by Skeeve (Parson) on Oct 10, 2005 at 12:06 UTC

    Not can skip but (in most cases) should skip.

    OTOH: You should have replied to the OP. I know of that fact, that's why I said that it's equivalent to

    ('name1,', 'name2,', 'name3')
    and not
    ('name1', 'name2', 'name3')

    Update: Just a side note ;-) Careful with those apostrophes! Generally there is no such thing as a plural apostrophe in any language I know of english and german. So it should be "commas" not "comma's" ;-)

    Update 2: Thanks to Perl Mouse I've learnd that the dutch language has a plural apostrophe in some cases. That's the reason for the correction above...


    $\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print
    A reply falls below the community's threshold of quality. You may see it by logging in.
    A reply falls below the community's threshold of quality. You may see it by logging in.