On Sat, 06 Sep 2008 16:01:08 +0100, brian54321uk wrote: > Just tried this, nothing happened at all.
Really. $ echo abc > /tmp/bar/one $ echo xyz > /tmp/bar/two $ echo ab..yz > /tmp/bar/three $ ls /tmp/bar one three two $ cat /tmp/foo #!/usr/bin/perl use strict; use warnings; sub delete_containing { my ($folder, @strings) = @_; my $regex = join '|', map { quotemeta } @strings; unlink grep { contains( qr/$regex/, $_ ) } glob "$folder/*"; } sub contains { my $regex = shift; local @ARGV = @_; local $_; /$regex/ and return 1 while <>; return; } delete_containing( '/tmp/bar', 'abc', 'xyz' ); $ /tmp/foo $ ls /tmp/bar three $ Reckon there's something wrong with your system. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/