$ perl -Mstrict -Mwarnings -E ' while (<>) { say "z-match" if /\A\d+[a-z]+\z/; say "Z-match" if /\A\d+[a-z]+\Z/; } ' 123dog Z-match