in reply to Re: weird problem or perl-bug?
in thread weird problem or perl-bug?

yep i've heard about it... forgot about it.. have to test... thanx alot
Does :
print 'a' if defined $vars[xxx]{zzz};
brings the element into existense.. i.e. how to check some element w/o turning it into existense if it doesnt exists already ?!

Replies are listed 'Best First'.
Re: Re: Re: weird problem or perl-bug?
by Corion (Patriarch) on Dec 20, 2003 at 15:52 UTC

    print 'a' if exists $vars[xxx]{zzz};
    will check whether the hash contains an element with the key zzz, but not autovivify it.

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
      So sorry Corion, but wrong ;)
      use Data::Dumper; my @vars; print 'a' if exists $vars[xxx]{zzz}; die Dumper \@vars; __END__ $VAR1 = [ {} ];
      First you check to see if you have a hash, then you check to see if your key exists.

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.