my $file = "test~";
my $regex1 = '^.+\Q~\E$';
my $regex2 = '^.+\\Q~\\E$';
bXkgJGZpbGUgPSAidGVzdH4iOwpteSAkcmVnZXgxID0gJ14uK1xRflxFJCc7Cm15ICRyZWdleDIgPSAnXi4rXFxRflxcRSQnOwpwcmludCBpbnQoJGZpbGUgPX4gbS8kcmVnZXgxLykuIlxuIjsKcHJpbnQgaW50KCRmaWxlID1+IG0vJHJlZ2V4Mi8pLiJcbiI7CnByaW50IGludCgkZmlsZSA9fiBtL14uK1xRflxFJC8pLiJcbiI7