I am trying to extract filenames with .url
extension using $name =~ s/\.url$//;
. However, some of the names contain an exclamation mark just before the extension, e.g.:
"for example-this!.url" "and-something-else!.url"
This causes perl to emit an error and stop running:
bash: !.url": event not found
Is there a way to overcome this problem? Below shows part of the relevant code that I am using:
foreach my $f (@ARGV) {
my (undef, $dir, $name) = File::Spec->splitpath($f);
$name =~ s/\.url$//;