in reply to counting number of fileds

If you are already splitting out the string:
my $string = "apple,banana,grape,orange"; my @fruit_array = split /,/,$string;
you can access the last three things using array indexes:
print "$fruit_array[-3], $fruit_array[-2], $fruit_array[-1]\n";
which prints:

banana, grape, orange

-enlil