On Fri, 2008-10-31 at 13:25 -0700, slow_leaner wrote: > On Oct 31, 10:27 am, [EMAIL PROTECTED] (Slow_leaner) wrote: > > Hi, > > Is there a way I can marge FILE2 into FILE1 or reverse together > > without creating a new merge file. I am not sure there are a better > > way to do it. If you give me some hint or help, i would appreciate > > it. > > thx. > > Here is my code. > > > > #!/bin/usr/perl > > > > open(FILE1, /usr/test1.txt); > > @temp =<FILE1>; > > close (FILE1); > > > > open(FILE2, /usr/test2.txt); > > @temp =<FILE2>; > > close (FILE2); > > Let me just add this to be clear. > I am so beginner, almost 4 moths, and not getting anywhere with perl. > I need some fire in my heart to keep me going. I just want someone to > show me how to fish but not to give me a fish. So all experts out > there please give me some hint. > > this is what I would like to do. > I know how to read one file into array. BUT > > 1. I would like to merge 2 logs file into array lets called > @array_of_logs. I might be add more logs file into this array later. > So that i can just type the another log file in to array without > writing another open close code. # my most difficult part. > > 2. matching the pattern that i have in array called @matching_list = > qr(a|b|test|go\thome|) #know how to match. > > 3. email it to me if match any. (not sure what man page i should be > reading for) > > SO all expert out there please give me some hint for this code. > > thx. > >
To cat a bunch of files: my @files = (); # Place your list of files in this array my @data = (); # Will be filled with the files' content { my @save = @ARGV; # Save the command-line arguments @ARGV = @files; # Avoids open-read-close local $/; # See `perldoc perlvar` and search for "INPUT_RECORD_SEPARATOR" @data = <>; # See `perldoc -f readline` @ARGV = @save; # Restore command-line arguments } -- Just my 0.00000002 million dollars worth, Shawn The map is not the territory, the dossier is not the person, the model is not reality, and the universe is indifferent to your beliefs. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/