in reply to Check for variable without leaving a trace
use Data::Dumper; print Dumper \%hash; print safe_defined(\%hash,"test","test2"); print Dumper \%hash; sub safe_defined { my ($h,@keys) = @_; for(@keys) { return 0 unless defined $h->{$_}; $h = $h->{$_}; } return 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Check for variable without leaving a trace
by educated_foo (Vicar) on Dec 09, 2009 at 14:47 UTC | |
by Fox (Pilgrim) on Dec 09, 2009 at 16:03 UTC | |
by educated_foo (Vicar) on Dec 09, 2009 at 16:34 UTC | |
by Fox (Pilgrim) on Dec 09, 2009 at 17:07 UTC |