jaco has asked for the wisdom of the Perl Monks concerning the following question:
So, in your opinion, is there a better way to do this and still keep strict?use strict; my %byte; my $mask = "267"; #example my @tests = ("test0", "test1", "test2", "test3", "test4", "test5", "test6", "test7", "test8"); @byte{@tests}= map { 1<<$_ } 0..8; #props to tye foreach my $test (@tests){ if($mask & $byte{$test}){ $mask = $mask ^ $byte{$test} unless $t->$test(); #if the test returned false we unset the bit } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Function refs, and trying to keep strict
by sauoq (Abbot) on Sep 25, 2003 at 02:33 UTC | |
|
Re: Function refs, and trying to keep strict
by Abigail-II (Bishop) on Sep 25, 2003 at 07:53 UTC | |
by jaco (Pilgrim) on Sep 25, 2003 at 14:42 UTC | |
|
Re: Function refs, and trying to keep strict
by Beechbone (Friar) on Sep 25, 2003 at 08:05 UTC | |
|
Re: Function refs, and trying to keep strict
by graff (Chancellor) on Sep 25, 2003 at 02:29 UTC |