On Thursday 09 August 2001 10:32, [EMAIL PROTECTED] wrote:
> "Syntax error at perl.txt line 8, near "$x".
>  Execution of perl.txt aborted due to compilation errors."
>
> $x=getc(INFILE);
> while($x!=eof(INFILE){

You'e missing a closing paren here.

However, even when I fix that this doesn't seem to run.  I have to admit, 
I've never, ever used the getc() function.  This is definitely not the 
canonical way to read from a file.

I guess I'd do something like this:

while( <INFILE> ){
    # process line here
}

But this gets the file a line at a time.

Do you really want to process the file a byte at a time?  I'd be inclined to 
read the whole file into a variable and process each character another way.  
Of course, there are certainly reasons you might want to process the file a 
byte at a time and getc() might be exactly what you need - I'm just not that 
familiar with it.

See also seek() if you need byte at a time access.

Regards,

Troy



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

Reply via email to