Michael G Schwern wrote: > > On Wed, Apr 17, 2002 at 02:34:20PM -0400, Bill -Sx- Jones wrote: > > Actually, the input data looks more like > > > > [SNEEX] > > .... > > [ADMIN] > > .... > > [END] > > # setup %Dispatch as before, then... > > while( $vData =~ /\[([A-Z])\]/g ) { > $Dispatch{$1}->(); > last if $End; > } >
There's already a %dispatch set up for you by perl... while( $vData =~ /\[([A-Z])\]/g ) { my $vSub = ucfirst lc $1; main->$vSub(); } Or put the subs in a different package if you're paranoid :) Also, wrap call in an eval{} if error handling for bad section wanted... -- Rick Klement