Home > Archive > PERL Miscellaneous > May 2005 > output question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| 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
| |
| Joe Smith 2005-05-27, 4:00 am |
| Huub wrote:
> 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
| |
|
|
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
| |
| Tad McClellan 2005-05-27, 4:00 pm |
| Huub <> wrote:
>
> 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
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
| |
|
| > 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.
| |
| Tad McClellan 2005-05-27, 8:57 pm |
| Huub <> wrote:
>
> 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?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
| |
|
| Tad McClellan wrote:
> Huub <> wrote:
>
>
>
>
>
> 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.
| |
| Tad McClellan 2005-05-28, 3:57 pm |
| Huub <> wrote:
> 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?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
| |
|
| Tad McClellan wrote:
> Huub <> wrote:
>
>
>
>
> ^^^^^^^
>
>
>
>
> 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
| |
| Tintin 2005-05-29, 3:58 am |
|
"Huub" <vdotniekerkatfreelerdotnl> wrote in message
news:429835de$0$151$3a628fcd@reader2.nntp.hccnet.nl...
>
> 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.
|
|
|
|
|