473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

writing parameters to a file

Dear everyone:
On page 120 of the book "Official guide to Programming with CGI.pm" (1998) the
author shows how to store parameters in a file for later retrieval, but I
can't make the scheme work. Somebody told me they heard this version of the
book was out of date and maybe the information on p120 is wrong. Here's my
script:
#!/usr/bin/perl -wT
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use strict;
my $co = new CGI;
open OUT,">cherie.txt" || die;
if (param()) {
save_parameters(OUT);
}
close OUT;
foreach my $name ( param() ) {
my @values = param($name);
print "<p><b>Name:</b> $name
<b>Value(s);</b> @values";
}
exit;

When When I do a perl -cT on this script, it says " Bareword 'OUT' not allowed
on line 8. I Don't understand why it gives me this message on an opened
filehandle. Is there another way to write the parameters to a file to retrieve
later? Thanks to everyone for the help.

Cherie
Jul 23 '05 #1
3 1265


CherieMc4 wrote:

On page 120 of the book "Official guide to Programming with CGI.pm" (1998) the
author shows how to store parameters in a file for later retrieval, but I
can't make the scheme work. Somebody told me they heard this version of the
book was out of date and maybe the information on p120 is wrong. Here's my
script:
#!/usr/bin/perl -wT


Try a Perl group for questions about CGI scripting for Perl, this group
is about HTML. Perl FAQ is here:
<http://faq.perl.org/>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
CherieMc4 wrote:

When When I do a perl -cT on this script, it says " Bareword 'OUT' not allowed
on line 8. I Don't understand why it gives me this message on an opened
filehandle. Is there another way to write the parameters to a file to retrieve
later? Thanks to everyone for the help.

Replace OUT with, for instance, $fout. Perl dose not recognize OUT as a
valid variable or keyword.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 23 '05 #3
Jim: Thank you. I wonder why, though, the filehandle needs to be a scalar
variable, eg $out. The filehandle XXX won't work in my script! This is true
only for the function save_param, I guess.
Also, on page 148 of "Learning Perl" 3rd edition there's a list filehandles
that may not be used, and OUT is not on the list! So I guess I learned two
things from one message! Thanks again!
Cherie
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jonathan Fine | last post by:
I'm writing some routines for handling dvi files. In case you didn't know, these are TeX's typeset output. These are binary files containing opcodes. I wish to write one or more dvi opcode...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
3
by: JemPower | last post by:
Hi, I've created a routine that reads from my sql server and outputs the contents to an XML file. I have two problems. Firstly, if an error occurs (i.e. the user doesn't supply the correct...
1
by: Marc Gravell | last post by:
Following up on a question somebody asked a day-or-so ago... When /reading/ BLOBs in C# I can use sequential access and GetBytes(); fine, sorted. However, is there a similar equivalent for...
0
by: Andrew Brook | last post by:
I have written a WSDL file and im experiencing a problem with specifying parameters for an operation. I was expecting for wsdl.exe to produce an abstract function with three parameters (because of...
2
by: totoro2468 | last post by:
Here is my code and output. Why is it writing to the array incorrectly, when I rewinded the file to the beginning? CODE: void ReadString (char *filename, int *lengthPtr) { FILE *ifp; char...
13
by: gonzlobo | last post by:
Greetings, and happyNewYear to all. I picked up Python a few weeks ago, and have been able to parse large files and process data pretty easily, but I believe my code isn't too efficient. I'm...
0
by: hshah | last post by:
Hello All, I have created a .aspx page with 7 text boxes and a save button. On click event following code is fired. It save the property information to sql server and also generate a unique Id...
9
by: Ron Eggler | last post by:
Hi, I would like to write binary data in a file i open (ofstream) with ios::binary but it keeps failing and it gives me a segmentation fault. What I'm exactly doing: if (isBinary == true) {...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.