in reply to eval question
my %op_table = ( le => sub { $_[0] <= $_[1] }, ge => sub { $_[0] >= $_[1] }, # etc. ); exists $op_table{ $op } or die "The operator '$op' does not exist.\n"; if ( $op_table{ $op }->( $a, $b ) ) { do something } else { do something else }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: eval question
by rhymejerky (Beadle) on Jan 06, 2011 at 21:21 UTC | |
by chromatic (Archbishop) on Jan 07, 2011 at 01:02 UTC |