my ($new_string, $longest_string) = '';
####
#!usr/bin/env perl
use strict;
use warnings;
use File::Temp qw(tempdir);
use File::Spec::Functions qw(catfile);
my $dir = tempdir('pmtest_XXXXX', TMPDIR => 1, CLEANUP => 1);
my $test_filename = '{a}';
my $full_path = catfile($dir, $test_filename);
open my $fh, '>', $full_path or die "Cannot create $full_path: $!\n";
print $fh "Hello world.\n";
close $fh;
print "We created $full_path as a file.\n"
if -e $full_path && -f _;
my $target = "$full_path.extra";
$target =~ s/$full_path//;
####
We created /tmp/pmtest_hmfIn/{a} as a file.
Unescaped left brace in regex is passed through in regex; marked by <-- HERE in m//tmp/pmtest_hmfIn/{ <-- HERE a}/ at mytest.pl line 23.