#!/usr/bin/perl -l $_ = "japhy"; 1 while /(.)/g; $_ = "upset"; print $1; # does this print 'y' or 't' for you?