how to check whether for each value in array is a numeric, alphabetical or alphanumeric (Perl)
- by dexter
i have array which values are user input like:
aa df rrr5 4323 54 hjy 10 gj @fgf %d
would be that array,
now i want to check each value in array
whether its numeric or alphabetic (a-zA-Z) or alphanumeric
and save them in other respective arrays
i have done:
my @num;
my @char;
my @alphanum;
my $str =<>;
my @temp = split(" ",$str);
foreach (@temp)
{
print "input : $_ \n";
if ($_ =~/^(\d+\.?\d*|\.\d+)$/)
{
push(@num,$_);
}
}
this works,
similarly i want to check for alphabet, and alphanumeric values
note: alphanumeric ex. fr43 6t$ $eed5 *jh