Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: recursive exists in perl

by gsiems (Chaplain)
on Dec 10, 2010 at 02:49 UTC ( #876365=note: print w/ replies, xml ) Need Help??


in reply to Re: recursive exists in perl
in thread recursive exists in perl

Is that really the case? For example, while the following doesn't autovivify $h{A}{B}{C} it does autovivify $h{A}{B}.

use Data::Dumper; my %h; if ( exists( $h{A}{B}{C} ) ) { print "Hi mom!\n"; } print Dumper \%h;

$VAR1 = {
          'A' => {
                   'B' => {}
                 }
        };


Comment on Re^2: recursive exists in perl
Download Code
Replies are listed 'Best First'.
Re^3: recursive exists in perl
by Anonymous Monk on Dec 10, 2010 at 02:54 UTC
    use Data::Dumper; my %h; no autovivification; if ( exists( $h{A}{B}{C} ) ) { print "Hi mom!\n"; } print Dumper \%h; __END__ $VAR1 = {};

      Ah! Here I was thinking that "no autovivification" was commentary.

      cpanp -i autovivification

      Runs script again... sweet.

      Thank you kind Anonymous for enlightening this humble monk.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://876365]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2015-07-31 03:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls