in reply to Sorting question
You could then write:
I warn you this is untested, but it's very similar to code I use with great frequency.use strict; use warnings; my %Functions = ( 'A' => { func => \&Sort1 }, 'B' => { func => \&Sort2 }, 'C' => { func => \&Sort3 }, 'D' => { func => \&Sort4 }, 'E' => { func => \&Sort5 }, ); sub GeneralizedFunction { my ( $flag ) = @_; # some processing if ( defined $Functions{ $flag } ) { $Functions{ $flag }{func}->(); # generalized sort } # other processing }
|
|---|