output question

H

Huub

Hi,

I'm writing a .pl in which I want to write to file:

format OUTPUT_FILE =
$buffer = "";
$INPUT_FILE = "BESTAND";
$OUTPUT_FILE = UITBESTAND;
open(INPUT_FILE) || die("Fout met openen inlees-bestand");
close(INPUT_FILE);
open(OUTPUT_FILE,">UITBESTAND") || die("Fout met openen te schrijven
bestand");
{do something}
write(OUTPUT_FILE);
close(OUTPUT_FILE);

This is the error I get:

bash-2.05b$ perl PROJECT.pl
Format not terminated at PROJECT.pl line 43, at end of line
syntax error at PROJECT.pl line 43, at EOF
Execution of PROJECT.pl aborted due to compilation errors.

line 43 is the last line.

Can somebody tell me what's wrong?

Thank you,

Huub
 
J

Joe Smith

Huub said:
Hi,

I'm writing a .pl in which I want to write to file:

format OUTPUT_FILE =
$buffer = "";

That is NOT the proper syntax for a format statement!
Go back and re-read the docs - you've got a piece of
punctuation missing.
This is the error I get:

bash-2.05b$ perl PROJECT.pl
Format not terminated

Exactly. You have to use the right terminator for the format.
-Joe
 
H

Huub

Posted it some time ago in another group without getting an answer. In
the meantime I got that one, so your answer is a confirmation....missing
a "." indeed. Yet, when I have the terminator in place like this:

# Declaratie format
format OUTPUT_FILE =
..
{do something}
open(OUTPUT_FILE,">UITBESTAND") || die("Fout met openen te schrijven
bestand");
write(OUTPUT_FILE);
close(OUTPUT_FILE);

UITBESTAND stays empty and I can't figure out why.

Also, is it possible to give arguments with perl, like:

perl <x.pl> <file to read> <word to check for>

If not, it'll save me the time looking for it.

Thanks,

Huub
 
T

Tad McClellan

Huub said:
Posted it some time ago in another group without getting an answer. In
the meantime I got that one, so your answer is a confirmation....missing
a "." indeed. Yet, when I have the terminator in place like this:

# Declaratie format
format OUTPUT_FILE =
.


The format is empty, so it will write() nothing, just like you
told it to. It is roughly equivalent to:

print '';

You need to read the documentation for format() yet again.



You do know that you don't need format() to make output, don't you?

{do something}
open(OUTPUT_FILE,">UITBESTAND") || die("Fout met openen te schrijven
bestand");
write(OUTPUT_FILE);
close(OUTPUT_FILE);

UITBESTAND stays empty and I can't figure out why.


What were you expecting instead?

The code is doing exactly what you told it to do.

If you want it to do something else, then tell it to do something else.

If you don't know how to tell perl to do that something else, then
tell *us* what the something else is. We are not mind readers.

Also, is it possible to give arguments with perl, like:

perl <x.pl> <file to read> <word to check for>

Yes.


If not, it'll save me the time looking for it.


So you better start looking then.

Start with the @ARGV variable in

perldoc perlvar
 
H

Huub

The format is empty, so it will write() nothing, just like you
told it to. It is roughly equivalent to:

print '';

You need to read the documentation for format() yet again.
You do know that you don't need format() to make output, don't you?

From the tutorial I'm studying, I understood I needed format() to write to an outputfile.
If you don't know how to tell perl to do that something else, then
tell *us* what the something else is. We are not mind readers.

I know, I just thought I gave enough info. If I didn't, sorry for that.
So you better start looking then.

Start with the @ARGV variable in

perldoc perlvar
Thank you.
 
T

Tad McClellan

Huub said:
From the tutorial I'm studying, I understood I needed format()
to write to an outputfile.


Sounds like you are attempting to learn from a foolish tutorial
(there are lots of those).

Which tutorial are you studying?
 
H

Huub

Tad said:
Sounds like you are attempting to learn from a foolish tutorial
(there are lots of those).

Which tutorial are you studying?

Introduction to Perl & CGI Programming
A complete course of study at free−ed.net
Copyright © 1999, Free−Ed, Ltd.
All rights reserved.
 
T

Tad McClellan

Huub said:
Tad McClellan wrote:

Introduction to Perl & CGI Programming
A complete course of study at free?ed.net ^^^^^^^
Copyright © 1999, Free?Ed, Ltd.
All rights reserved.


Do you mean free-ed.net instead?

I find no titles there for "CGI", and a different one from what you've
quoted for "Perl".

I would like to assess the quality of the tutorial that you are
using. To do that, I need something that will allow me to find
exactly what you are using so that I can review it.


Is it available online? If so, at what URL?
 
H

Huub

Tad said:
Do you mean free-ed.net instead?
Yes..apparently the copy-paste didn't work out 100%.
I find no titles there for "CGI", and a different one from what you've
quoted for "Perl".

It's a pdf file I got from someone. I don't know if it's available online.
I would like to assess the quality of the tutorial that you are
using. To do that, I need something that will allow me to find
exactly what you are using so that I can review it.


Is it available online? If so, at what URL?
If you like, I can send it to you.

Huub
 
T

Tintin

Huub said:
Introduction to Perl & CGI Programming
A complete course of study at free?ed.net
Copyright © 1999, Free?Ed, Ltd.
All rights reserved.

Given that it has a copyright of 1999, it is almost likely to be totally out
of date with current Perl/CGI practices.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,171
Messages
2,570,934
Members
47,472
Latest member
KarissaBor

Latest Threads

Top