Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using $cgi->param('myname') as a string

Status
Not open for further replies.

inspleak

Technical User
Mar 10, 2004
14
US
Hey guys, I seem to not fully understand what is returned by using $cgi->param('myName');

I'm trying to do add on a bit to the myName argument.
It looks like this:

use CGI;
my $cgi = new CGI;

$myNewName = $cgi->param('newName');
$myNewName = "stuff".$newName;

then it would be called:

and I would expect $myNewName to be stuffJake.

However I get an error:
Use of uninitalized value in concatenation (.) or string at /var/
Any ideas?

Thanks so much!
-Jake
 
Jake
Code:
"stuff".$myNewName
is probably the answer to your question

--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
ah, sorry that was a typo on my part. (I wasn't actually at the machine when I posted)
In the actual code it does say "stuff".$myNewName

Sorry for the confusion.
So unfortunately the issue still remains. Thanks very much for the reply though!
 
This worked for me:
Code:
use CGI;

my $cgi = new CGI;
$myNewName = $cgi->param('newName');
$myNewName = "stuff".$myNewName;
print $cgi->header();
print $cgi->start_html();
print $myNewName;
print $cgi->end_html();
Double-check for typos in your code and make sure you're using the right param and variable names. If you still have a problem, post some of the actual code.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top