ramya2005 has asked for the wisdom of the Perl Monks concerning the following question:
Thanksmy $code = 'default'; my $hash = {"1"->'ENABLE', "2"->'DISABLE'}; # Call function foo with the scalar my $ret = foo($code); # Call function foo with the hash $ret = foo($hash); sub foo(){ $param = shift; # If $param is a scalar # Do something # Else # Do something }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to Check whether the Function Parameter is a Scalar or a Hash
by Skeeve (Parson) on Oct 05, 2005 at 22:26 UTC | |
by Ovid (Cardinal) on Oct 05, 2005 at 23:25 UTC | |
by sauoq (Abbot) on Oct 06, 2005 at 02:05 UTC | |
by radiantmatrix (Parson) on Oct 06, 2005 at 18:29 UTC | |
by Roy Johnson (Monsignor) on Oct 06, 2005 at 16:39 UTC |