in reply to Re: Precedence of qw
in thread Precedence of qw

doc,

I was looking at qw() for maintenance purposes; so some one would be able to type in a new word if need be instead of the extra comma, quote, quote--Yes, picky, I know. But, again, this is used a lot in Perl to allow for easy modification.

Your code will not work because q(X) x 2 results in ('XX') not ('X', 'X') as you can see via:
#!/usr/bin/perl -w use strict; my @array; push @array, q(X) x 2; print join ' - ', @array, "\n"; @array = (); push @array, ('X') x 2; print join ' - ', @array, "\n";

Replies are listed 'Best First'.
Re^3: Precedence of qw
by ikegami (Patriarch) on Apr 04, 2006 at 17:39 UTC
    (q(X)) x 2 would give ('X', 'X')
Re^3: Precedence of qw
by doc_faustroll (Scribe) on Apr 05, 2006 at 02:51 UTC
    aha. I see. thanks.
    although if you are using single words? I can see the need for a list context with a list of things.

    anyhoo, glad the fix is in release, and my compliments to you for a clever username. one of the more clever ones on perlmonks.