if ($PI =~ m/(\d)$/) { print "The last digit is $1.\n"; } else { print "Seems that pi does not end in a digit. Who knew?\n"; }