$searches, # An arrayref of hashrefs like: # { # searchver => # BIBLE VERSION, I.E. TABLE IN DB # comp => # COMPARISON QUERY TO MATCH AGAINST THIS VERSION # case => # WHETHER TO MATCH THIS QUERY CASE-SENSITIVELY (BOOLEAN) # wholeword => # WHETHER TO REQUIRE QUERY TO MATCH ONLY WHOLE WORDS (BOOLEAN) # startverse => # MUST MATCH AT START OF VERSE (BOOLEAN) # endverse => # MUST MATCH AT END OF VERSE (BOOLEAN) # flexdelimit => # MATCH WORDS DELIMITED BY USER-SELECTED DELIMIT CHARS (BOOLEAN) # delimitchars => # ACTUAL CHARS TO USE AS DELIMITERS, AS ENTERED BY USER # regex => # USE PERL REGULAR EXPRESSION (BOOLEAN): VOIDS OTHER OPTIONS ABOVE # yn => # WHETHER TO MATCH (YES) OR NOT (NO) (BOOLEAN) # } #### ( $ch, $noreplace )= resetBadBooleans( $ch, $noreplace ); for my $search (@$searches) { for (qw( case wholeword startverse endverse flexdelimit regex yn )) { $search->{$_}= resetBadBooleans($search->{$_}); } } #### my @bool_keys= qw( case wholeword startverse endverse flexdelimit regex yn ); @{$_}{@bool_keys}= resetBadBooleans(@{$_}{@bool_keys}) for @$searches; #### $regex= composeRegex($search->{case}, $search->{wholeword}, $search->{startverse}, $search->{endverse}, $search->{flexdelimit}, $search->{delimitchars}, $search->{regex}, $search->{comp}) #### $regex= composeRegex($search); ... sub composeRegex { my ($search, $extra)= @_; # you might still un-pack these into local variables for convenience my ($regcase, $wholeword, $startverse, $endverse, $checkdelimit, $delimitchars, $useperl, $query) = @{$search}{qw( case wholeword startverse endverse flexdelimit delimitchars regex comp )}; ... }