Hi,

I have an array file_list which contains absolute/relative paths of
files. I want to remove duplicate elements and elements whose
filenames(not the path) are same. How can i do this using grep and
hash?

My code
=======
my @file_list= qw(aaa ddd bbb/aaa ccc ddd kkk/ddd hhh);
my %exist=();
#To remove duplicate elements.
my @unique = grep { ! $exist { $_ }++ } @file_list;
#To remove elements with same filename.
#Please write your code here.

O/p should be => ccc hhh

Is it possible to do both deletion operations with one single grep?

Please help me..


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to