in reply to Can't get the desired output..

My first instinct would be to use split() on a comma.   And then maybe use a negative array-index to get to the last element, e.g.:

$ perl -e 'my $foo="Moe,Curly,Irene"; my @bar=split(/,/, $foo); print @bar[-1]."\n";' Irene