#!/usr/bin/perl -w use strict; use warnings; use File::Find; use Getopt::Long; my %options=(); my @libs; my %seen; #getopt("b",\%options); GetOptions (\%options, 'data=s') or die("\nERROR:Invalid Option\n"); find(sub { push @libs, "$_\n" if -f && /\.lib$ && serport && serport_d/ && !$seen{$_}++; }, "$options{data}"); for my $file (@libs) { print "\n$file"; }