Tanya, If all you want to do is add header info to the top of a bunch of files, you could use something like the script below, which is simpler than using grep, etc. The script below would be invoked as (for example): perl header.pl C:\*.c D:\*.cpp Hope this helps, Jesse #Begin Script #!/usr/bin/perl use strict; use warnings; my @files; foreach (@ARGV) { #look through each arg passed on the cmd line push @files, glob($_); #and do wildcard expansion on them. } #(i.e. "C:\*.pl" becomes a list of all files in #the C:\ directory which end in ".pl". undef $/; my $header = "Insert your header info here...\n"; foreach (@files) { #Read the contents of the file. open FILE, "$_" or die "Error: Couldn't open $_ for reading: $!\n"; my $text = <FILE>; close FILE; open FILE, ">$_" or die "Error: Couldn't open $_ for writing: $!\n"; $text = $header . $text; #attach the header at the top of the file, print FILE $text; #and write the new version of the file. close FILE; } #End Script -----Original Message----- From: Tanya Graham [mailto:[EMAIL PROTECTED]] Sent: Monday, June 04, 2001 11:48 AM To: 'Arthur Cohen'; [EMAIL PROTECTED] Subject: RE: grep this is how it is called: AddHeader.pl -f [directory name] -e [extension list] this tells the program to add a header to the files with extensions "extension list" in "directory name". I would actually prefer to have them comma separated, so can you explain how to replace the commas with "|"? i know i've seen that function before, but i can't remember what it is called... thanks tanya -----Original Message----- From: Arthur Cohen [mailto:[EMAIL PROTECTED]] Sent: Monday, June 04, 2001 11:38 AM To: [EMAIL PROTECTED] Subject: RE: grep : : : if i take the argument from a flag (so i won't be using : @ARGV, but opt_x) : would i still be able to use join? You can do what you want to do, but I'm not sure exactly what you're trying to do. How are you calling the program from the command line, and how are you pulling the command-line arguments into variables? If the file extentions are already in a single scalar variable (e.g. comma-separated or something) rather than an array like @ARGV, then you may need to do a split first, then a join, or you may just be able to separate your comma separator (or whatever) with a | character. --Art _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users