in reply to split to get the dir name

Why not do it The Right Way™ with File::Basename instead?
use File::Basename; my @file = qw(/path/to/file1 /path/to/file2.sql); print basename($_),"\n" for @file;
UPDATE:
I didn't realize that our questioner was using the output of 'ls -la' (even though it is more than obvious to me now). Please don't do that. davis's suggestion is a much better one.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)