You should really post separate threads for new questions, since people often stop checking older threads when they seem to have been answered. You also probably want to spend some time with Perl's internal documentation (check
perldoc perldoc) and or a good introductory book on Perl. I like
Beginning Perl which is available free online.
You can get take apart a file name using the File::Basename module. It's part of Perl's core, so you don't need to install anything extra.
Code:
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
my $fullpath = '/usr/local/bin/somedaemon';
my $basename = basename $fullpath;
my $dirname = dirname $fullpath;
print "The full path is $fullpath\n";
print "\tBasename: $basename\n";
print "\tDirname: $dirname\n";
For getting unique elements from a list, you probably want to use a hash or a module. See the perlfaq answer at
perldoc -q duplicate for a few suggestions.