Rob Dixon wrote:
> 
> You can do exactly that in Perl, and a lot more simply:
> 
>   my @variables = (3, 7, 13, 4, 12);
>   my @tests = ("2*a+b==c", "c-d+a==e");
> 
>   foreach (@tests) {
>     s/([a-z])/$variables[ord($1) - ord('a')]/ge;

You don't need the /e option there.  (Try it if you don't believe me.)

>     print $_, "\n";
>   }


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to