The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 09-03-2007
captoro captoro is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 3
OP = operator ?

here is what I have from what you told me.
Code:
#!/usr/bin/perl -w
use Time::localtime;
 
str1=`date "+%d%m%y"`;
open (FILE,"<traffic_TLG");

foreach $line (<FILE>) {
  if ($line =~ m/beth/) {
  open (FILE, ">>log_$str1.txt");
  
    @items =  split(",",$line);
    print FILE $items[4], ",", $items[10], ",", $items[15], ";" . "\n";

	close(FILE); 
  }

}

close (FILE);
I get a cannot modify a constant scalar error when I run it. Otherwise the program works. why does'n it work?

Last edited by blowtorch; 09-03-2007 at 10:16 AM..