Help for this page
my $operator = '+'; my( $x, $y ) = (2, 5); eval "print \$x $operator \$y, qq/\\n/;";
my( %dispatch ) = ( '+' => sub { return $_[0] + $_[1]; }, ... or die "I don't know how to $operation.\n"; my( $x, $y ) = ( 2, 5 ); print $dispatch{$operation}->( $x, $y ), "\n";