use strict; use warnings; my @tests = ( ".", "", "A sentence.", ".gitignore", "word.doc", "a.dotted.name", ); print /^.*(\..*)$/ ? "Matched '$1' in " : "Failed", " '$_'\n" for @tests;