Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbi question

Status
Not open for further replies.

cginewbie

Programmer
Jan 20, 2002
24
US
Hi,
how do you know if the passed argument is an integer, pointer to an array, pointer to a harsh, or whaever?

for ex.
sub a{
my $a = shift;
if($a is an interger{ ...}
elsif($a is a pointer to a string){...}
elsif($a is a pointer to an array){...}
elsif($a is a pointer to a harsh){...}
return whatever
}

and i can call this a() like this
a($int);
a(\@a);
a(\%a);
...

how do i do that?


 
use ref() which should return SCALAR, ARRAY, HASH, CODE, REF, BLOB or LVALUE.

on the command line type:

perldoc -f ref

for further explanation.

HTH,
Barbie. Leader of Birmingham Perl Mongers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top