The ||= operator is used to set a default value, so that you have a value if the user doesn't put one in. So what it is saying is that if $x doesn't have a value or has a false value, then give it the value of $y if it is TRUE, else make it an empty string. I can't see the usefulness out of context.
-----Original Message----- From: Eric Beaudoin [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 12, 2002 9:10 AM To: José Nyimi Cc: [EMAIL PROTECTED] Subject: Re: Help on syntax At 12:02 2002.05.12, José Nyimi wrote: >Hello All, > >Could you explain this syntax please ? > >$x ||= $y || ''; > >Thanks, > >José. > $a ||= $b is the same as $a = $a || $b; So your exmaple translate to $x = $x || $y || ''; This, I think, means that $x take the value of $y if $x is false (undefined , 0 or an empty string). If $y is also false, $x takes the empty string value. The || operate is a short-circuit meaning that it stop resolving the chain as soon as it finds a True value. This has the effect that the first true value will be result of the whole thing. Hope this helps. >--------------------------------- >Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français ! ---------------------------------------------------------- Éric Beaudoin <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]