[plug] Perl Question

Patrick Tehvand patrick at tehvand.com
Mon Jul 26 12:18:08 WST 2004


Ryan wrote:

> On Mon, 2004-07-26 at 11:52, Patrick Tehvand wrote:
> 
>>I may be making things to complex for myself but is there a way to join 
>>two scalar values to give the name of a scalar?
>>
>>my brain says litteraly it should be:
>>
>>$ifvariable = $scalar1 . $scalar2;
>>if ($"$ifvariable" eq blah) {
>>
>>I know above doesnt work. nether does adding a $ to the "$ifvariable" 
>>using .
> 
> 
> You want to 'construct' variable names from scalar values?
> 
> $scalar1 = 'sca';
> $scalar2 = 'lar3';
> $scalar3 = 'blah';
> $ifvariable = $scalar1 . $scalar2;
> if (${$ifvariable} eq 'blah') { print "scalar3 is blah\n"; }
> 
> Is that what you mean?
> 
> Ryan
> 
> _______________________________________________
> PLUG discussion list: plug at plug.linux.org.au
> http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au
> 
Thanks that worked well.

And thanks to Bernard for the reminder that TIMTOWTSAC.

Patrick



More information about the plug mailing list