catfish1116 has asked for the wisdom of the Perl Monks concerning the following question:
using 'Learning Perl' and I'm trying to figure out a way to remove multiple files. I created a script that would remove 1 file, (like a rm function), but not more than 1. Below is the code
#! /usr/bin/perl use v5.16.3; use strict; use warnings; #### # Program works like rm function for just one file # 11/20/19 # #### print "Please enter the files to be removed: \n"; chomp(my @removed_files = <STDIN>); foreach (@ARGV) { unlink $_ or warn "Cant unlink '$_': $!, continuing ... \n"; }
TIA the catfish
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: remove files
by hippo (Archbishop) on Nov 20, 2019 at 16:22 UTC | |
by catfish1116 (Beadle) on Nov 20, 2019 at 17:17 UTC | |
by hippo (Archbishop) on Nov 20, 2019 at 23:24 UTC | |
Re: remove files
by ogrp (Initiate) on Nov 21, 2019 at 18:18 UTC | |
Re: remove files
by Don Coyote (Hermit) on Nov 21, 2019 at 17:31 UTC | |
by catfish1116 (Beadle) on Nov 25, 2019 at 17:40 UTC | |
by haukex (Archbishop) on Nov 25, 2019 at 21:42 UTC | |
by Don Coyote (Hermit) on Nov 25, 2019 at 21:32 UTC | |
by haukex (Archbishop) on Nov 25, 2019 at 21:43 UTC | |
by Don Coyote (Hermit) on Nov 25, 2019 at 22:22 UTC |