in reply to modifying multiple files

To do it your way you would just write @ARGV = qw/file1 file2 file3/; but you can just provide these filenames from the command line, so if your perl script is called do_it then you call it with perl do_it file1 file2then $ARGV[0] in your program would contain file1 and $ARGV[1] would be file2.

You can specify the backup copy also from the command line with perl -i.bk do_it foo.barinstead of using $^I = '.bk';

-- Hofmator

Replies are listed 'Best First'.
Re: Re: modifying multiple files
by Anonymous Monk on Aug 03, 2001 at 20:18 UTC
    That's helpful, thanks -
    I have a lot of files, though; is there a way to automatically do it to all .bar files?

      yes, just use the filename expansion of your shell, i.e. perl -i.bk do_it *.bar and all files in the current directory ending in .bar are processed by the script in place (the backups have the additional ending .bk)

      -- Hofmator