I m trying to search for a particular *.xml files and then delete it from a directory.
following code is throwing me an error.
my $file = "abc*.xml*";
my $searchdir = "/tst";
my $searchdir = shift;
my $searchfile = shift;
print "Searching in $searchdir \n";
# Open and close the directory
opendir DIR, $searchdir or die("An error occured: $!");
my @files = readdir(DIR);
foreach my $currentFile (@files)
next if $currentFile =~ /^\./;
if ( $currentFile eq $searchfile )
print "Found the file: $searchdir/$curre
if ( -d "$searchdir/$currentFile" )