- or download this
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";
- or download this
file1=>file1.txt
file2=>file2.txt
- or download this
foreach my $line (@teststr)
{ my ($key, $val);
...
($key = $val) =~ s/\.txt//;
$testhash{$key} = $val;
}
- or download this
my %testhash = map {(my $val = (split /\//, $_)[-1]); ((my $key = $va
+l) =~ s/\.txt//);} @teststr;
- or download this
1 => 1