
japhy
Enthusiast
Dec 16, 2000, 10:31 PM
Post #4 of 5
(9856 views)
|
Re: How Do I Read Data From A Form?
[In reply to]
|
Can't Post
|
|
Function calls do not expand in quotes -- you need to do:
print "foo's value is ", param("foo"), "\n"; # or $value = param("foo"); print "foo's value is $value\n"; Or, you can use the deref-array-ref trick, which creates a reference to an anonymous array, and then dereferences it inside a double-quoted string. I'll show it as a whole, and then break it down:
print "foo's value is @{[ param("foo") ]}\n"; The trick is that arrays are interpolated inside double quotes, and therefore, if you can put the stuff you want printed inside an array, then you can print it. And we can turn anything into an array by putting it inside a REFERENCE to an array, and then dereferencing it:
print "@{ # printing an array, and dereferencing... [ # a reference to an array... param("foo") # containing this function's return value ] }\n"; Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author
(This post was edited by japhy on Dec 16, 2000, 9:43 PM)
|