[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Question....



#! /usr/bin/perl

use CGI;

my $q = new CGI;
my $name = $q->param('name');
my $age = $q->param('age');

open(FILE, ">/some/file/name"); # Change > to >> for append mode.
print FILE join('|', $name, $age), "\n";
close FILE;

__END__

You can also use the CGI module's save method:

#! /usr/bin/perl

use CGI;

open(FILE, ">/some/file/name"); # Change > to >> for append mode.
$q->save(FILE);
close FILE;

__END__

Then the data in the file will be URL escaped, but you can get it unescaped
by use of CGI:

#! /usr/bin/perl

use CGI;

my $old_q = new CGI('/some/file/name');
my $name = $q->param('name');
my $age = $q->param('age');

/Cajo.

At 03.21 +0200 99-05-02, Christopher C. Winn wrote:
>Example... let's say the person fills out his or her name and
>age, and clicks whatever button to submit it... and the URL
>looks like this:
>
>.............myperl.pl?name=chris winn&age=15
>
>I would like the script to save that data in the file as....
>chris winn|15|

___Carl_Johan_Berglund_________________________
   Adverb Information
   carl.johan.berglund@adverb.se
   http://www.adverb.se/



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org