Home > Archive > PERL Beginners > April 2005 > Question about || (was REGEXP removing - il- - -b-f and - il- - - - f)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Question about || (was REGEXP removing - il- - -b-f and - il- - - - f)
|
|
| Peter Rabbitson 2005-04-27, 3:56 pm |
| > also
> "or die" is more preferable than "|| die"
Why is that? :) I was actually going to post a question about ambiguity
syntax later, but here it is anyway. Are the following 4 equivalent?
1)
if ($b) {
$a = $b;
}
else {
$a = $c;
}
2)
$a = $b or $c;
3)
$a = $b || $c;
4)
$a = $b ? $b : $c;
Also there was an example on the web that completely threw me off. Although
this works:
local ($/);
,I have no idea how it undefs $/. Points to a good reading on the
subject are equally appreciated.
Thanks
Peter
| |
| Peter Rabbitson 2005-04-27, 3:56 pm |
| On Wed, Apr 27, 2005 at 09:06:39AM -0500, Peter Rabbitson wrote:
> Also there was an example on the web that completely threw me off. Although
> this works:
>
> local ($/);
>
Sorry about this last one, I undrestand the idea of local for globs, I just
thought that
local $/;
and
local ($/);
differ. While reading your answers I realised that it's the same as saying:
my ($a); which is equivalent to my $a; It is pretty weird to have equivalent
operators ( 'or' / '||' ) with different precedence. I guess this is where
TIMTOWTDI bites back really bad... learning something new every day :)
|
|
|
|
|