×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Help Please with CGI/Perl Script

Help Please with CGI/Perl Script

Help Please with CGI/Perl Script

(OP)
Hi,

I'm new to CGI/Perl programming and I'm having a lot of trouble with a script that I'm trying to get working. If some one could help me it would be great. Here is the code that I'm working on:

if ($ENV {'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
foreach $pair (split(/&/, $buffer)){
($key, $value) = split(/=/, $pair);
$key =~ tr/t/ /;
$value =~ tr/t/ /;
$value=~s/%/([a-fA-F0-9][a-fA-F0-9]/pack("C", hex($1))/eg;
$parameters{$key} = $value;
}

open (TEMP, ">>/cgi-bin/temp.dat");
open (FILE, "/cgi-bin/helplog.dat");

while($line = )
{
if ($name eq $parameters{searchfor})
{
print TEMP $line;
}
}
close (TEMP);
close (FILE);




 
 

 

RE: Help Please with CGI/Perl Script

Well, from what I can see, there are a few problems:

First, in the %parameters hash, you have it called wrong, I guess is how you would say it. Saying $parameters{searchfor} does not work, instead, you have to say $parameters{'searchfor'}.
 
Second, the while($line = ) is something that I have never seen before. I am not sure what you are trying to do, but if you are trying to assign the scalar $line to the file, then you should do something like $line = <FILE>;.

I hope this helps, you should probably also post what is the error message you are getting.

Hope this helps.


-Vic

RE: Help Please with CGI/Perl Script

(OP)
Thanks a lot for the help. I did get it working before your reply came in, although I'm not sure how. I'm now going to go back and look at the code some more. Once again thanks a lot for the help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close