if $mypath =~ "mydirectory/dirOne/pagehere.cgi" { print "results here"; } #Now my attempt not working: if $mypath =~ "mydirectory/dirOne/*.cgi" { print "results here"; }