Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^3: keys %::

by Sec (Scribe)
on Jul 20, 2005 at 12:43 UTC ( #476484=note: print w/replies, xml ) Need Help??

in reply to Re^2: keys %::
in thread keys %::

I have improved this script a bit, it can recurse into symbol tables now.
I learned something new today. Internals::SvREADONLY can reset the readonly flag :)
my $table=shift||''; $table.="::"; dumptable($table); sub dumptable{ my $table=shift; my $indent=shift||''; while (my ($key,$value)=each %$table ){ print qq!$indent"$key":\n!; if(defined(*{$value}{SCALAR}) and defined(${ *{$value}{SCALAR}})){ print "$indent\tSCALAR: ",${*{$value}{SCALAR}}, "\n"; } if(defined( *{$value}{ARRAY} ) ) { print "$indent\tARRAY: ", join ", ",@{*{$value}{ARRAY}}, "\n"; } if(defined( *{$value}{HASH} ) ) { if ($key =~ /::$/){ print "$indent\tSYMTAB:\n"; dumptable($value,"\t".$indent) if (*{$value}{NAME} ne "main::"); }else{ print "\tHASH:\n"; while(my ($k, $v) = each %{ *{$value}{HASH} } ) { print "$indent\t\t$k => $v,\n" } } } if(defined( *{$value}{CODE} ) ) { print "$indent\tCODE: ",*{$value}{CODE},"\n"; }; if(defined( *{$value}{IO} ) ) { print "$indent\tIO: ",*{$value}{IO},"\n"; }; print "\n" } }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://476484]
[choroba]: I can't connect to (www. or not)
[choroba]: .com works slowly, .net is fine
[LanX]: thanks for the tip
[LanX]: org had problems, but never thought about switching domain
LanX can't connect to net

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-01-22 20:29 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (190 votes). Check out past polls.