my $dir = "c:\"; if ($dir =~ /REGULAR EXPRESSIONS/) { print ("Valid path: $dir"); } else { print ("Invalid path: $dir"); }