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
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 passe
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:
> {
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 w
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 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 se
> 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 { ...)
>
>>> $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
ines
>
>
>
> my $buffer='BUFFER TEXT or array ref';
> my $res=$self->MySub($buffer);
>
>sub MySub
> {
> my $self=shift;
> my $buffer=shift;
> my $result;
>
>
> #your code
>
>
> return $re
TECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Thomas R Wyant_III
> Sent: Friday 22 February 2002 15:33
> To: Cc: [EMAIL PROTECTED]
> Subject: Re: Repost: problems with elsif and $self
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
>
>
>
> > Problem 1:
essage-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Thomas R Wyant_III
> Sent: Friday, February 22, 2002 10:33 AM
> To: Cc: [EMAIL PROTECTED]
> Subject: Re: Repost: problems with elsif and $self
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
<[EMAIL PROTECTED]> wrote:
> Problem 1:
> if/elsif fails. The first if stmt evaluates to false, but then the
> subsequent elsif stmts are never tested, ...
C:\1Tmp>type foo.pl
if (0) {
print "FALSE is TRUE!\n";
}
elsif {
print "FALSE is FALSE.\n";
}
C:\1Tmp>perl foo.pl
sy
On Thu, 21 Feb 2002 [EMAIL PROTECTED] wrote:
> I fat fingered the last post and am reposting. I am running win2k sp w/ AS
> Perl 5.6.1
>
> Problem 1:
>
> if/elsif fails. The first if stmt evaluates to false, but then the
> subsequent elsif stmts are never tested, such as:
>
> if()
> {
>
> }
13 matches
Mail list logo