On 8/31/07, Hunter Barrington <[EMAIL PROTECTED]> wrote: > is there a type() function in perl? i need to be able to test the > contents of an array and > if (type($value)=='string' or type($value)=='int') {print "i win";}
You probably meant to use the 'eq' (string equality) comparison operator instead of the '==' (numeric equality) operator. But there's no type() function, because Perl doesn't have a concept of "type" like yours. A variable can be both an integer and a string at the same time. Here's a FAQ entry that may help: http://perldoc.perl.org/perlfaq4.html#How-do-I-determine-whether-a-scalar-is-a-number%2fwhole%2finteger%2ffloat%3f Does that help with your problem? Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/