Maybe it's a little overkill, but if you plan making your grammar a bit more - er -
complicated you can take a look to
Parse::RecDescent and satellite stuff. In particular, a problem very similar to yours is dealt with in
this tutorial at perl.com.
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
Don't fool yourself.