RE: Question on the "Camel" book

2006-09-21 Thread Thomas Bätzler
Hi, flotsan <[EMAIL PROTECTED]> asked: > I am reading the Perl Camel book - Programming Perl 3rd Ed > and having a bit of trouble to understand some of the ideas > presented in section 2.11.2. > Specifically it is told the following two statements are different: > > 1) if ($_ = ) { print; }

Re: Question on the "Camel" book

2006-09-21 Thread John W. Krahn
flotsan wrote: > Hey guys, Hello, > I am reading the Perl Camel book - Programming Perl 3rd Ed and having a bit > of trouble to understand some of the ideas presented in section 2.11.2. > Specifically it is told the following two statements are different: > > 1) if ($_ = ) { print; }

Re: Question on the "Camel" book

2006-09-21 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John W. Krahn wrote: > Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two of those > are valid input from the readline operator. > > > > John Should running the above from the command line make a difference? I ran them both enter

Re: Question on the "Camel" book

2006-09-21 Thread Dr.Ruud
"flotsan" schreef: > it is told the following two statements are > different: > > 1) if ($_ = ) { print; } # suboptimal: doesn't test defined > 2) if (defined($_ = )) { print; } # best > > But as I see it, these two do the same thing perl -le ' print defined($_) ? "\"$_\"" : "" ,

Re: Question on the "Camel" book

2006-09-21 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dr.Ruud wrote: > "flotsan" schreef: > >> it is told the following two statements are >> different: >> >> 1) if ($_ = ) { print; } # suboptimal: doesn't test defined >> 2) if (defined($_ = )) { print; } # best >> >> But as I see it, these two do the

Re: Question on the "Camel" book

2006-09-22 Thread John W. Krahn
Mathew Snyder wrote: > John W. Krahn wrote: >>>Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two of those >>>are valid input from the readline operator. > > Should running the above from the command line make a difference? I ran > them both entering 0 each time and I got 0 back

Re: Question on the "Camel" book

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John W. Krahn wrote: > Mathew Snyder wrote: >> John W. Krahn wrote: Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two of those are valid input from the readline operator. >> Should running the above from the command l

Re: Question on the "Camel" book

2006-09-22 Thread flotsan
Thanks... Now I see the one with "defined" test deals better with those possible "false" "false" inputs:-) flotsan ""John W. Krahn"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Mathew Snyder wrote: >> John W. Krahn wrote: Yes, Perl has five "false" values: undef, (), 0, ''

Re: Question on the "Camel" book

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > John W. Krahn: >> Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two >> of those are valid input from the readline operator. > > Should running the above from the command line make a difference? I > ran them both entering 0 each time and I got 0 back. T

Re: Question on the "Camel" book

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > Dr.Ruud: >> flotsan: >>> it is told the following two statements are >>> different: >>> >>> 1) if ($_ = ) { print; } # suboptimal: doesn't test defined >>> 2) if (defined($_ = )) { print; } # best >>> >>> But as I see it, these two do the same thing >> >> perl -le ' >

Re: Question on the "Camel" book

2006-09-22 Thread John W. Krahn
Dr.Ruud wrote: > Mathew Snyder schreef: >>John W. Krahn: > >>>Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two >>>of those are valid input from the readline operator. >>Should running the above from the command line make a difference? I >>ran them both entering 0 each time and

Re: Question on the "Camel" book

2006-09-22 Thread Dr.Ruud
"John W. Krahn" schreef: > Dr.Ruud: >> Mathew Snyder: >>> John W. Krahn: Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two of those are valid input from the readline operator. >>> >>> Should running the above from the command line make a difference? I >>> ran them bot

RE: Question on the "Camel" book

2006-09-23 Thread John
Upon reflection -- and I'm surprised Randal hasn't picked this up -- the "problem" might be more deep-seated than we imagine. With respect to the good Perl-Meisters who've answered so far, I should like to add this: Shouldn't it be "Flotsam", and not "flotsan"? (Hey! After all, somebody'