my @teststr;
my %testhash;
$teststr[0] = "32977186 4 -rw-r--r-- 1 owner mygrp 65 Aug 4 13:16 /long/path/to/my/file/file1.txt";
$teststr[1] = "32977186 4 -rw-r--r-- 1 owner mygrp 65 Aug 4 13:16 /long/path/to/my/file/file2.txt";
####
file1=>file1.txt
file2=>file2.txt
####
foreach my $line (@teststr)
{ my ($key, $val);
$val = (split /\//, $line)[-1];
($key = $val) =~ s/\.txt//;
$testhash{$key} = $val;
}
####
my %testhash = map {(my $val = (split /\//, $_)[-1]); ((my $key = $val) =~ s/\.txt//);} @teststr;
####
1 => 1