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!
  • Students Click Here

*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

NAMING in Perl

NAMING in Perl

NAMING in Perl

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?

Thanks to anyone who helps - you are a star!!

Gordon Bell

RE: NAMING in Perl

Not exactly sure what you're getting at...  If you mean:

$lisa_sue = $bob

then, sure, that's going to work.

Otherwise, I'm a little unclear as to what you want to do...

RE: NAMING in Perl

I think you can use references to achieve the desired effect.  If this looks like it is close to what you are asking, you will need to do a little homework on references. .......a simple example.  

$var1 = 'lisa';
$var2 = 'sue';
$var3 = 'bob';

$$var1 = 'bruntte';     # now $lisa is a brunette
$$var2 = 'blonde';     # now $sue is a blonde
$$var3 = '12';     # now $bob is 12

$var4  = $var1.$var2;
    # var4 concatenates the contents of var1 and var2 (lisasue)

$$var4 = $$var3;    # symbolically speaking - $lisasue is now 12

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