#!/usr/bin/perl # safe form of IPC open requires perl 5.8.0 use v5.8.0; my $DIR = '/some/directory'; my $STRING = 'hidden!'; open my $fh, '-|', 'find', $DIR, qw/-type f -exec grep -lF/, $STRING, qw/{} ;/ or die $!; chomp (my @found = <$fh>); # @found now contains the list of files matching the string;