Sander:

I have an answer, and a comment:

The answer: select wants a filehandle, so line 7 wants to read

select EL;

The comment:

You are probably complicating things a great deal by using select.


#!/usr/bin/perl -w
open (ER, "</home/unicorn/Plscripts/error_log"); #opening error_log for reading
open (EL, ">/home/unicorn/Plscripts/ERROR.LOG"); #opening ERROR.LOG for writing

while (<ER>) {                          #as long as ER is open, read....
      chomp;
     print EL $_, "\n";                 #print output to ERROR.LOG
 }

The changes:

1. I removed all mentions of select.
2. I made the open statements explicit as to which file was being opened for 
reading and for writing.
3. I added the filehandle to the print statement.
4. I added a newline the the print statment, otherwise it would print 
everyline without one, resulting in a vary hard to read log file.
5. I took the $_ out of quotes, as it it not strictly needed, and I prefer as 
little punctuation as possible.

If you were never going to do anything else in the while loop, it could be 
this:

while (<ER>) { print EL $_; }


I think select is one of the statements that you don't need for most small 
projects. I have never used it in my 6 or so years of perl coding.
-- 
The musician has three disciplines: the disciplines of the hands, the head and 
the heart.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to