my $test_match = "D:/newdir/cgi-bin/testbin/errors/"; #Here it will match just fine $test_match =~/(.*?)\/([^\/]+)$/; print "
*****$1*****$2****
";exit; #But in here the if doesn't, it will go to the ELSE, why? if($test_match =~/(.*?)\/([^\/]+)$/){ print "
^^^^$1^^$2^^^^
";} else{ print "No Match"; } exit;