> "perl" == perl <[EMAIL PROTECTED]> writes:
perl> Can someone show me how to make this compute?
perl> my $a=2;
perl> my $b=3;
perl> my $oper="+";
perl> my $c = $a $oper $b;
perl> where $c would have a value of 5.
A lot faster and safer than the "eval" solution:
my %ops = (
"+" => sub {
thanks
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Friday, October 17, 2003 3:54 PM
>> To: [EMAIL PROTECTED]
>> Subject: making a variable execute
>>
>>
>> Can someone show me how to make this compute?
>>
>> my $a=2;
>> my $b=3;
>> my $oper="+";
>>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 17, 2003 3:54 PM
> To: [EMAIL PROTECTED]
> Subject: making a variable execute
>
>
> Can someone show me how to make this compute?
>
> my $a=2;
> my $b=3;
> my $oper="+";
>
> my $c = $a $oper