in reply to Function that accepts both hashes/arrays and hashrefs/arreyrefs
Updated code blockmy $Input = $ArrayRef || $HashRef; set_value( $Input ); sub set_value { #recieve the passed variable(s) #my $self = shift;#For OO subs my $Arg = shift; if ( ref $Arg eq 'HASH' ) { ### Handle a hash $Arg->{key} } elsif ( ref $Arg eq 'ARRAY' ) { ### Handle an array $Arg->[$index] } else { ### Must not be an array ref or hash ref } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Function that accepts both hashes/arrays and hashrefs/arreyrefs
by Porculus (Hermit) on Jun 19, 2009 at 18:38 UTC |