in reply to Shell trick to edit many files with perl

Or rather than invoke Perl twice:
use File::Find; my @new_list; find sub { push @new_list, $File::Find::name if --- some criterion here ---; }, @ARGV; @ARGV = @new_list; $^I = ".bak"; while (<>) { s/old/new/g; print; }

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Shell trick to edit many files with perl
by jepri (Parson) on May 23, 2001 at 20:09 UTC
    That's so much better than mine! I never knew I could do inplace edits from within the program.

    Plus I think mine will flake out if the file name starts with a space

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.