[plug] Perl Question
Bernard Blackham
bernard at blackham.com.au
Mon Jul 26 12:06:44 WST 2004
On Mon, Jul 26, 2004 at 11:52:07AM +0800, 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 .
I think you're probably looking for an eval block, eg:
$a = 'foo';
$b = 'bar';
eval "\$$a$b = 'blah'";
print $foobar."\n";
HTH,
Bernard.
--
Bernard Blackham <bernard at blackham dot com dot au>
More information about the plug
mailing list