Harry Jackson wrote at Tue, 16 Jul 2002 16:22:52 +0200:
> If I have the following variables splits are numbers and totals are operators how
>can I have them
> executed to get the value.
>
> $split[0] $total[0] $split[1] $total[1] $split[2] $total[2] $split[3] $total[3]
>$split[4];
> 45 \ 3 + 6 -
> 4 * 2
>
What have you tried so far ?
Where did the error occurred ?
Why do you think it is a scalar context problem ?
What is '\' for an operator ?
I assume it is a '/' and then you can use e.g. eval to do the dirty work:
my @split = qw(45 3 6 4 2); # I only redefinded them
my @total = qw( / + - * ); # So that I can work with them
eval 'my $result = ' . join "", map {$split[$_], $total[$_]} (0 .. $#split);
print $result;
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]