in reply to hash assignment using map with multiple statements

As ikegami has mentioned, you have to remember what "map" returns - as the docs say, it's an evaluation of each operation within the block as a list (in my experience, the "s///" inside a "map" is one of the most common mistakes that new users of "map" make.)

Incidentally, since you're already using a regex inside your block, you don't really need that "split":

#!/usr/bin/perl -w use strict; my @teststr = ( "32977186 4 -rw-r--r-- 1 owner mygrp 65 Aug 4 13:16 /long/pa +th/to/my/file/file1.txt", "32977186 4 -rw-r--r-- 1 owner mygrp 65 Aug 4 13:16 /long/pa +th/to/my/file/file2.txt", "32977186 4 -rw-r--r-- 1 owner mygrp 65 Aug 4 13:16 /long/pa +th/to/my/file/file3.txt", "32977186 4 -rw-r--r-- 1 owner mygrp 65 Aug 4 13:16 /long/pa +th/to/my/file/file4.txt", ); my %testhash = map { m{(([^/]+)\.[^/]+)$}; $2, $1 } @teststr; print "$_ => $testhash{$_}\n" for sort keys %testhash;

Output:

file1 => file1.txt file2 => file2.txt file3 => file3.txt file4 => file4.txt

--
"Language shapes the way we think, and determines what we can think about."
-- B. L. Whorf