RE: !$state

2004-07-16 Thread Tim Johnson
Thank you, yes. That is an important distinction. -Original Message- From: Randal L. Schwartz [mailto:[EMAIL PROTECTED] Sent: Fri 7/16/2004 7:17 AM To: [EMAIL PROTECTED] Cc: Subject: Re: !$state >>&g

Re: !$state

2004-07-16 Thread Randal L. Schwartz
> "Tim" == Tim Johnson <[EMAIL PROTECTED]> writes: Tim> "$state = ()" assigns the value of an empty list to the scalar $state, so it would evaluate to false. No, it doesn't. It evaluates () in a scalar context, which returns a scalar undef. Hence, same as "$state = undef". Right conclusio

RE: !$state

2004-07-16 Thread Bob Showalter
David Arnold wrote: > All, > > If: > > $state={}; Now state is a reference to an anonymous HASH > > Then, what is: > > !$state This is '' (i.e. "false"), because the ! operator returns 1 ("true") only for the values '', 0, and undef. Any reference will be "true" in this test, even a referenc

Re: !$state

2004-07-16 Thread Harald Richard Ashburner
Tim Johnson said: > > >Someone can probably give a better answer, but practically speaking, this is what >I've seen to be true (someone please give me a verbal whipping if I'm off here): > >Perl evaluates a statement as false if it > >a) is undefined >b) evaluates to 0 >c) evaluates to '' (em

RE: !$state

2004-07-16 Thread Tim Johnson
M To: Tim Johnson Cc: David Arnold; [EMAIL PROTECTED] Subject: Re: !$state so to investigate this further, I want to look at what perl takes as "Truth". I want to nail down for my own benefit the differences

Finding perl documentation (was: Re: !$state)

2004-07-15 Thread Randy W. Sims
Harald Richard Ashburner wrote: Question: How do I get an index or a table of contents? How do I find out how to search the perldocs for "control structures" I've tried: perldoc perldoc perldoc -f if perldoc -q control perldoc -q index perldoc -q contents perldoc -q perldoc eg perldoc perltoot g

Re: !$state

2004-07-15 Thread Harald Richard Ashburner
Hi Team, Tested code that prints a value for !$state when $state is initialized with my $state = (); #!/usr/local/bin/perl # #set $state to () to find out what !$state is use strict; use warnings;

RE: !$state

2004-07-15 Thread Tim Johnson
$state evaluates as true (I think that's what you're asking). $state = {}; if($state){ print "\$state is true: $state\n"; }else{ print "\$state is false"; } $state is true because it's not empty. It's a referen

Re: State Variables

2002-09-30 Thread Robin Cragg
Here's a simple version... $a = 5; while ($a) { foreach (1..10) { if ($_ == $a) { $exit++; } } last if ($exit); } print "\$a is $a\n"; R At 20:20 27/09/2002 -0700, Michael Kelly wrote: >On Fri, Sep 27, 2002 at 08:29:53PM -0500, Grant Hansen wrote:

Re: State Variables

2002-09-30 Thread Michael Kelly
On Fri, Sep 27, 2002 at 08:29:53PM -0500, Grant Hansen wrote: > Can anyone provide an example of how to use a state variable to break out of a > loop? > > Thanks I smell homework. But to be fair: what do you have so far? Why doesn't it do what you want? If you showed us your code where you wer

Re: State Variables

2002-09-27 Thread John W. Krahn
Grant Hansen wrote: > > Can anyone provide an example of how to use a state variable to break out of a > loop? Can you provide an example or explanation of what you are trying to do? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: State of pseudo-hashes, typed lexicals

2001-09-10 Thread Michael Fowler
On Mon, Sep 10, 2001 at 11:27:51AM +0200, Edwin G?nthner wrote: > The pseudo-hashes have no autovivification - therefore > $self->{recieve} will result in an error. When using > hashes, the new hash entry is created without my knowledge. [snip] > And as far as I understand there is no way to avoi

Re: State of pseudo-hashes, typed lexicals

2001-09-10 Thread Edwin Günthner
Michael Fowler wrote: > Tearing out the pseudohash code gives an across the board 10-15% > gain in speed in basic benchmarks. That means if we didn't have > pseudohashes, normal hashes would be just as fast as fully declared > pseudohashes! > > So don't mourn their passing.

Re: State of pseudo-hashes, typed lexicals

2001-09-10 Thread Michael Fowler
On Mon, Sep 10, 2001 at 10:39:51AM +0200, Edwin G?nthner wrote: > > They are experimental, and it's not a good idea to rely on them in > > production code. In fact, pseudo-hashes are on their way out. Typed > > Sorry to hear that. I liked the idea to have something more efficient > than hashes

Re: State of pseudo-hashes, typed lexicals

2001-09-10 Thread Edwin Günthner
Hello Michael, > They are experimental, and it's not a good idea to rely on them in > production code. In fact, pseudo-hashes are on their way out. Typed Sorry to hear that. I liked the idea to have something more efficient than hashes ... on the other hand it is apparent that implementing ps

Re: State of pseudo-hashes, typed lexicals

2001-09-10 Thread Michael Fowler
On Mon, Sep 10, 2001 at 10:08:15AM +0200, Edwin G?nthner wrote: > Are pseudo-hashes and typed lexicals still "experimental" > or is it save to use them in a project that will might > be used for 3 to 5 years? They are experimental, and it's not a good idea to rely on them in production code. In