Daniel D Jones wrote:
: Ah! Simple change:
Subroutines should not normally operate on external data.
Pass data into and out of each subroutine. As a matter of style,
I avoidsqashingwordsinvariableandsuborutinenamesalltogether. I
like to use an underscore for most names.
run_tests( [EMAIL PROTECTED], [EMAIL PROTECTED] );
: sub runtests() {
sub run_tests {
my( $tests , $values ) = @_;
: my $test;
: foreach (@tests) {
: $test = $_;
foreach my $test ( @$tests ) {
: $test =~ s/([a-z])/$values[ord($1) - ord('a')]/g;
$test =~ s/([a-z])/$values->[ord($1) - ord('a')]/g;
: return 0 unless eval $test;
This doesn't look right. If eval fails half way through @tests
you will have half of @tests converted and half unconverted. Are
you sure you want to change @tests and not work on a copy?
: }
: return 1;
: }
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer
254 968-8328
Don't tread on my bandwidth. Trim your posts.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>