in reply to Avoiding multiple *if* statements

like this
my %known_formats = ( 'format1', [ [qw[ meal drink cost ]], '(.+)\s\"(.+)\"\s(.+)\s(\d{1,2})' ] ); for my $format ( keys %known_formats ){ my $re = $known_formats{$format}[1]; my $fields = $known_formats{$format}[0]; $dockets{$docket_cnt}{@$fields} = $line =~ /$re/; }

Replies are listed 'Best First'.
Re^2: Avoiding multiple *if* statements
by kabeldag (Hermit) on Jul 05, 2008 at 12:59 UTC
    I was thinking of doing something like that with the line fields/values, but within the original array.
    Anyhow, thanks very much for that! Much appreciated :-)