in reply to Re^2: Precedence of qw
in thread Precedence of qw
Your version of perl probably implements
qw(A B C)
as
split(' ', q(A B C))
(although I suspect it performs said split at compile-time).
Given the above, consider the following passage from split's documentation:
In scalar context, returns the number of fields found and splits into the @_ array. Use of split in scalar context is deprecated, however, because it clobbers your subroutine arguments.
If you want the count, use my $scalar = () = qw(A B C);.
By the way, I said "your version of perl" because perl 5.6.1 gives
Useless use of a constant in void context at 541192.pl line 4. Useless use of a constant in void context at 541192.pl line 4. C
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Precedence of qw
by diotalevi (Canon) on Apr 04, 2006 at 17:39 UTC |