SPUG: trinary ? operator

Meryll Larkin humbaba9 at yahoo.com
Fri Jan 25 19:22:08 CST 2002


Hi Folks, 

I'm using Active Perl5.005_03 on Windows98 and 5.6.1
on Windows2000 professional edition and I can't get
the trinary ? operator to work.  Does anyone have any
experience with this in Windows?  Does my syntax need

On pg 92 of Programming Perl (2nd Edition) an example
of the trinary operator is given:

$a = $ok ? $b : $c;

I find if I use this syntax, I get an assignment to $b
(the "true" choice) because $a = $ok has a single =
instead of ==.  

If I try to use == I don't get an error, the entire
line seems to be ignored.  

If I use strings and use "eq" the line is also

Turning on -w gets me this error:
Useless use of private variable in void context.
Useless use of private variable in void context.
(yes, twice, I assume it refers to $b and $c)



Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/

More information about the spug-list mailing list