The code I wrote is as below :
#!/usr/bin/perl
my @input = ( "a.txt" , "b.txt" , "c.txt" ) ;
my @output = map { $_ =~ s/\..*$// } @input ;
print @output ;
My intention is to let the file name without the extension stored in the array @output.
but instead it stores the value returned by s/// rather than the changed file name in @output, so the result looks like
1
1
1
so what is the correct way to use map under this situation?