#!/usr/bin/perl -w use strict; use File::Glob qw(bsd_glob); use File::Path; my $fname = "empty"; my @found_files; my @found_files1; while (! @found_files) { print "Please enter the file name: "; chomp($fname = ); @found_files = glob( "/Users/jsmith/data/$fname*" ); if (@found_files != 1) { print "File does not exist!"; }; }; print "The following files have been deleted: \n"; print "$_\n" for @found_files; while (@found_files != 0) { rmtree (@found_files); @found_files = glob( "/Users/jsmith/data/$fname*"); };