On Nov 7, 2007 9:23 PM, Panda-X <[EMAIL PROTECTED]> wrote: > I have a script like this : > > sub This { print @_ } > > This ( -x => 100 ) ; # prints -x100 > This ( x => 100 ) ; # prints x100 > > ## > It seems that's something just as is. > However, I saw many packages would like to use : -option => value > So what's the point for this style ? Is there any specific reason for that ? > > Thanks, > Panda-X >
from perldoc perlop Unary "-" performs arithmetic negation if the operand is numeric. If the operand is an identifier, a string consisting of a minus sign con- catenated with the identifier is returned. Otherwise, if the string starts with a plus or minus, a string starting with the opposite sign is returned. One effect of these rules is that -bareword is equivalent to "-bareword". Try perl -le 'print - - "foo"' and see what happens. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/