Ah, you'll probably want single quotes around the search string if it is multi word...
my @found = `grep -ls '$search_string' *`; ----- Original Message ----- From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: "james" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, July 15, 2002 4:13 PM Subject: Re: unlinking all files that contain a specified string > What about (assuming *nix) > > use strict; > > my $search_string = "Whatever you want to find"; > > my @found = `grep -ls $search_string *`; > chomp( @found ); > unlink( @found ); > > or are you working under Windows? > ----- Original Message ----- > From: "james" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, July 15, 2002 3:51 PM > Subject: unlinking all files that contain a specified string > > > hi, all! > > friday while trying to clean up a directory, i thought i could bang out a > quick-and-dirty perl script that would let me achieve what i needed, to > delete all text files in a subdirectory that contain a specified string. i > was able to use the perl command unlink(filename) and grep manually, but i > couldn't seem to put them together in a script that would do what i needed. > > does anybody know how to do this? > > (i'm asking out of laziness so i'm hoping the person who answers this > doesn't have to put much, if any, effort into doing so :)) > > thanks, > james > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]