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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"no fill on GD" GD.PM 1.18 HELP ME PLEASE

Status
Not open for further replies.

calabama

Programmer
Feb 19, 2001
180
US
Using GD.PM ver1.18 (GIFS ALLOWED)

This is the portion of my CGI that is not making sense to me. When I use the variable $TOP instead of $black the image is not filled. However when I look at the value of $TOP it is $black.

--------------------works---------------------------

# Put a black circle around the top of image and fill it
$TOP="\$"."black";
$im->arc(79,74,14,14,0,360,$black);

$im->fill(79,74,$black);


-----------------does not work-----------------------
# Put a black circle around the top of image and fill it
$TOP="\$"."black";
$im->arc(79,74,14,14,0,360,$black);

$im->fill(79,74,$TOP);
 
when you have "$black" or "$TOP" in your code, perl does a lookup for that variable ONCE, and put's it's value into place there. the string, "\$black" is just that, a string. perl doesn't know that you want the string interpreted as a variable itself. here's one way to do what you want to do (the other way i know is stupidly complex, and i'm ashamed i even spent the brain time coming up with it. if you care, it's somewhere recent in this forum...):
set $TOP equal to "black" -- no "\$".
whenever you want the value assigned to the variable $black to appear, put: "[tt]${$TOP}[/tt]". ta da! :cool: "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top