From: "Ing. Branislav Gerzo" <[EMAIL PROTECTED]>
> Kamalraj Singh Madhan, Noida [KSM], on Friday, February 4, 2005 at
> 13:38 (+0530 ) typed:
>
> KSM> Kindly let me know if this possible, deleting some selected
> files from a KSM> directory through a perl script. This selection
> would be based on the KSM> filename existing in a particular text
> file, if it exists then delete from KSM> directory otherwise not since
> I do not want to delete all of the files in KSM> this directory.
>
> my @files = ( 'D:\test\test.txt', 'D:\test\test2.txt' );
> #if you want read read that txt with file list:
> #my @files = `cat filelist.txt`; #or use type, if you haven't cat
Don't shell out (start external programs) for things you may do in
Perl easily:
Eg.
my @files = do {open my $IN, '<', 'filelist.txt'; <$IN>};
or (simpler, but longer)
open my $IN, '<', 'filelist.txt';
my @files = <$IN>;
close $IN;
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>