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?
Is it possible to do this with one single grep?
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
Please help me.