[plug] Perl Question
Ryan
ryan at is.as.geeky.as
Mon Jul 26 12:07:45 WST 2004
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
More information about the plug
mailing list