>I'm not yet able to read certain parts of perl code. What is this
>comparison/alternation after the hash lookup on 'otherid' called, and what
>does the code do?
>
>  $myvar->{id} = ($myvar->{otherid}) ? 'stringA' : 'stringB';

It's a "ternary" or "flip-flop" statement. In
this case, the above is the equivalent of:

 "if myvar->otherid is set, then set myvar->id to
  stringA, otherwise, set it to stringB".

Code-wise, the above is equivalent to:

 if ($myvar->{otherid}) { $myvar->{id} == 'stringA' };
 else                   { $myvar->{id} == 'stringB'; }


-- Morbus Iff ( i put the demon back in codemonkey ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ My book, Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/ icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to