> Telemachus wrote: >> On Fri Aug 07 2009 @ 2:55, Admin wrote: >>> Hi there, >>> >>> is there a page that explains the ||= operator and similar >>> operators? >>> google is not quite finding the special characters in the first 10 >>> hits. >> Google and punctuation don't mix well, apparently. >> >> In any case, try perldoc perlop in a terminal or online: >> http://perldoc.perl.org/perlop.html >> > > thanks > > I searched the docs for ||= > here is the result > > Search results for query "||="
I am no expert on this, and not being able to find any example of ||=, I wrote this; #!/usr/bin/perl use strict; my $a = $a || 2; print "$a\n"; $a = 3; my $a = $a || 2; print "$a\n"; my $a = $a ||= 2; print "$a\n"; undef $a; my $a = $a ||= 2; print "$a\n"; So I come to the conclusion that || and ||= are the same, but in terms of precedence, || will have the higher precedence than ||= -- Owen -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/