On Fri, 22 Feb 2002, John Deighan wrote:
At 04:16 PM 2/22/2002 -0500, Carl Jolley wrote:
On Fri, 22 Feb 2002, Cornish, Merrill wrote:
$self- {PERMIT} eq undef
That's not valid. It should be !defined($self-{PERMIT});
What makes you say that it not valid? It passes syntax checks.
The problem as I see it is that the two statements
($var eq undef) and (!defined($var)) potentially mean
different things. Yes you can make them do the same
thing, but not always. I think that this was the
point.
--- Carl Jolley [EMAIL PROTECTED] wrote:
my $var = '';
if ($var eq undef) {
[EMAIL PROTECTED] wrote:
snip!
Problem 1:
if/elsif fails. The first if stmt evaluates to false, but then the
subsequent elsif stmts are never tested, ...
snip!
C:\1Tmptype foo.pl
if (0) {
print FALSE is TRUE!\n;
}
elsif {
print FALSE is FALSE.\n;
}
C:\1Tmpperl foo.pl
: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Thomas R Wyant_III
Sent: Friday, February 22, 2002 10:33 AM
To: plopez
Cc: [EMAIL PROTECTED]
Subject: Re: Repost: problems with elsif and $self
[EMAIL PROTECTED] wrote:
snip!
Problem 1:
if/elsif fails. The first if stmt
Wyant_III
Sent: Friday 22 February 2002 15:33
To: plopez
Cc: [EMAIL PROTECTED]
Subject: Re: Repost: problems with elsif and $self
[EMAIL PROTECTED] wrote:
snip!
Problem 1:
if/elsif fails. The first if stmt evaluates to false, but then the
subsequent elsif stmts are never tested
$self- {PERMIT} eq undef
That's not valid. It should be !defined($self-{PERMIT});
Merrill
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
I vote this thread be stopped ;)
It is obvious that the code in question is bogus. Look at the elsif
statement ... it is certainly invalid. You can't just have
hanging elsif
(you need at least elsif(0) {, which the perl compiler/parser
will probably
convert to else { ...)
I have to say that there are a number of ugly things
about this code. No offense meant -- let me show what
I mean.
!($foo =~ /match_me/) is more easily written (and
clearer) as $foo !~ /match_me/
The first and last clause of the if-elsif chain are
identical.
The conditions for the sixth and
I would like to suggest to the originator of this post that he considers one Perl's
case-type structures instead of all of the elsif
statements:
SWITCH:
{
if (test1) {do something; last SWITCH;}
if (test2) {do something; last SWITCH;}
if (test3) {do something; last SWITCH;}
...
}
I
I know that the case-type structure is notd as
preferable, but frankly I don't see why. Instead of
'elsif', you have to add 'last SWITCH;' to each if
statement. How is this better?
Or is there something stating that the 'last'
statement is faster/more efficient than an 'elsif'?
And while I'm
Dirk Bremer [EMAIL PROTECTED] wrote:
I would like to suggest to the originator of this post that he considers
one Perl's case-type structures instead of all of the elsif
statements:
But if/elsif *is* one of Perl's case-type structures, since
Perl doesn't have switch/case.
SWITCH:
{
11 matches
Mail list logo