|-----Original Message-----
|From: Ing. Branislav Gerzo [mailto:[EMAIL PROTECTED]
|Sent: Friday, April 29, 2005 7:11 PM
|To: beginners@perl.org
|Subject: Re: REGEXP removing - il- - -b-f and - il- - - - f
|
|
|[EMAIL PROTECTED] [D], on Friday, April 29, 2005 at 09:30 (-0400)
|wrote about:
|
|DOc> well,  I am trying to get beyond a beginner as I have doing Perl for 3
|DOc> years now so is your answer still the same?
|
|I think really good programmers write "nice" readable programs
|(scripts), so begginers should understand that sooner. I think, that's
|why better using "or" instead "||".
|

'||' and 'or' have different precedences. Some important operators which
have a higher precedence than 'or' but lower precedence than '||' are the
comma operator, the assignment operator, '=>'(dunno what this operator is
called in Perlism).

Code involving these operators will break if you simply assume that the
difference between '||' and 'or' is only style.
eg
$var = $a || $b
$var = $a or $b  ##there you go

open A,"$file" or die("$! : whoopsie!!")
open A,"$file" || die("$! : whoopsie!!")

or in a more wierd manner, where unbeknownst to you, the entire context of
evaluation changes.

##code starts
use strict ;
use warnings ;
sub sub_returns_array {
return wantarray() ? qw/abc def crf/ : "scalar returned :-/" ;
}
my @arr1 = sub_returns_array || die ;
my @arr2 = sub_returns_array or die ;
print "arr1 : @arr1\n" ;
print "arr2 : @arr2" ;
##code ends

Manav


|--
|
|How do you protect mail on web? I use http://www.2pu.net
|
|["Pooh was a wise Taoist, wasn't he?" -- Robin Mowat]
|
|
|
|--
|To unsubscribe, e-mail: [EMAIL PROTECTED]
|For additional commands, e-mail: [EMAIL PROTECTED]
|<http://learn.perl.org/> <http://learn.perl.org/first-response>
|
|


*********************************************************
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s) or 
attachment(s) if any) are privileged and confidential material of MBT and 
should not be disclosed to, used by or copied in any manner by anyone other 
than the intended addressee(s).   In case you are not the desired addressee, 
you should delete this message and/or re-direct it to the sender.  The views 
expressed in this E-mail message (including the enclosure(s) or attachment(s) 
if any) are those of the individual sender, except where the sender expressly, 
and with authority, states them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be free of 
any virus.  However, it is the responsibility of the recipient to ensure that 
it is virus free and MBT is not responsible for any loss or damage arising in 
any way from its use

*********************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to