in reply to Re: Logic Question
in thread Logic Question

Thank you. Very good point. yes, I am going to rename the file. But, see. I can't get the thing to work. I need to break it up into smaller chunks maybe.

Replies are listed 'Best First'.
Re^3: Logic Question
by ysth (Canon) on Feb 22, 2008 at 23:44 UTC
    Get it working for one file, with a hardcoded filename. Then see if you are correctly generating a list of files. Then add in the loop over the list of files?
      question: you pointed out earlier. why is my filehandle closing on this. I foreach, get cf, then try to read it. But, it says: ERRROR No such file or directory at ./B.p line 10, <CF> chunk 49. thanks
      1 #!/usr/bin/perl -w 2 use strict; 3 my $agent = "best1agent_start"; 4 my $collect = '/usr/bin/su - patrol /usr/adm/best1_default/bgs +/scripts/best1collect -q>>$LOG 2>>$LOG'; 5 open CF_FILES, "cf.files" or die "Error: $!"; 6 my @cf_files=<CF_FILES>; 7 #close CF_FILES; 8 foreach my $cf(@cf_files){ 9 my $line; 10 open (CF, "$cf") or die "ERRROR $!"; 11 while ($line = <CF>){ 12 if($line =~ /$agent/){ 13 print $line; 14 # $line = "$collect"; 15 # print $line; 16 } 17 } 18 }