On Fri, Apr 4, 2008 at 1:17 PM, <[EMAIL PROTECTED]> wrote:
snip
> > my $part = $parts{ $key }{ +PART_NUMBER };
snip
> Thanks for your help. Your suggestion worked, but what exactly is the
> '+' doing in this case?
snip
from perldoc perlop
Unary "+" has no effect whatsoever, even on strings. It is useful
syntactically for separating a function name from a parenthesized
expression that would otherwise be interpreted as the complete list of
function arguments.
Unary + has no effect on its argument (it doesn't even force scalar
context on lists). It has at least three uses:
1. for anal people who have to say +123 to indicate that 123 is positive
2. to prevent parsing of a list as the sole arguments to a function
without parenthesis, compare these:
perl -le 'print (1, 2, 3, 4), " what are we fighting for"';
perl -le 'print +(5, 6, 7, 8), " open up the Perly gates"';
3. since + is not part of the set of bareword characters it forces the
parsing of a bareword as a function in hash indices
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/