$string = 'abcd\\'; print "Matched\n" if '\\' eq substr $string, -1;