Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Keep It Simple, Stupid
 
PerlMonks  

How do you check if a key exists without creating it ?

by exilepanda (Monk)
on Oct 06, 2012 at 08:36 UTC ( #997601=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Data::Dumper;
    $x = {};
    ...
    1 if ( exists $x->{Y}{X}  ) ;
    1 if ( defined $x->{Z}{A}  );
    print Dumper $x;
    
  2. or download this
    $VAR1 = {
              'Z' => {},
              'Y' => {}
            };
    
  3. or download this
    if ( $x->{Y} ) {
      if ( $x->{Y}{Z} ) {
        1 if ( $x->{Y}{Z}{A} ) ;
      }
    } ; # $VAR={};
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://997601]
Approved by philipbailey
Front-paged by philipbailey
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-04-18 03:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (461 votes), past polls