MrFloydFreak42 has asked for the wisdom of the Perl Monks concerning the following question:
#!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>; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File Stricture Help
by pc88mxer (Vicar) on May 14, 2008 at 02:44 UTC | |
by MrFloydFreak42 (Novice) on May 14, 2008 at 02:49 UTC | |
|
Re: File Stricture Help
by chromatic (Archbishop) on May 14, 2008 at 02:51 UTC | |
by ysth (Canon) on May 14, 2008 at 05:46 UTC | |
by chromatic (Archbishop) on May 14, 2008 at 17:15 UTC | |
|
Re: File Stricture Help
by chrism01 (Friar) on May 14, 2008 at 06:16 UTC | |
by Anonymous Monk on May 14, 2008 at 06:51 UTC |