#!usr/local/bin/perl -w use strict; my $count; my $in; my @files = glob '*.bak'; foreach my $file (@files) { $count++; } print "$count backup files found!\n\n"; print "Delete these files: (Y/N)? "; chomp ($in = <STDIN>); while ($in =~ /[^yn]/i) { print 'Y or N, please: '; chomp ($in = <STDIN>); } if ($in =~ /^y/i) { delfiles(); print "$count files were deleted!"; } sub delfiles { foreach my $file (@files) { open $file; unlink <$file>; } }
In reply to File Stricture Help by MrFloydFreak42
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |