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

NAMING in Perl

Status
Not open for further replies.

DJpennywhistle

Programmer
Jun 1, 2000
32
US
I have three variables $lisa and $sue are strings, and $bob is a value. I want to name a string lisa_sue and assign it the value bob. Is this possible?<br><br>Thanks to anyone who helps - you are a star!! <p>Gordon Bell<br><a href=mailto:gordon.bell@xilinx.com>gordon.bell@xilinx.com</a><br><a href= > </a><br>
 
Not exactly sure what you're getting at...&nbsp;&nbsp;If you mean:<br><FONT FACE=monospace><br>$lisa_sue = $bob<br></font><br>then, sure, that's going to work.<br><br>Otherwise, I'm a little unclear as to what you want to do...
 
I think you can use references to achieve the desired effect.&nbsp;&nbsp;If this looks like it is close to what you are asking, you will need to do a little homework on <i>references</i>. .......a simple example.&nbsp;&nbsp;<br><br><FONT FACE=monospace><br>$var1 = 'lisa';<br>$var2 = 'sue';<br>$var3 = 'bob';<br><br>$$var1 = 'bruntte'; &nbsp;&nbsp;&nbsp;&nbsp;# now $lisa is a brunette<br>$$var2 = 'blonde'; &nbsp;&nbsp;&nbsp;&nbsp;# now $sue is a blonde<br>$$var3 = '12'; &nbsp;&nbsp;&nbsp;&nbsp;# now $bob is 12<br><br>$var4&nbsp;&nbsp;= $var1.$var2;<br>&nbsp;&nbsp;&nbsp;&nbsp;# var4 concatenates the contents of var1 and var2 (lisasue) <br><br>$$var4 = $$var3;&nbsp;&nbsp;&nbsp;&nbsp;# symbolically speaking - $lisasue is now 12<br></font>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top