The code I wrote is as below :
#!/usr/bin/perl my @input = ( \"a.txt\" , \"b.txt\" , \"c.txt\" ) ; my @output = map { $_ =~ s/\\..*$// } @input ; print @o
You are missing the 's' for substitution.
$_ =~ /\..*$//
should be
$_ =~ s/\..*$//
Also you might be better off to use s/\.[^\.]*$// as your regular expression to make sure you just remove the extension even when the filename contains a '.' (dot) character.
s/\.[^\.]*$//