in reply to Re: Regex or Index
in thread Regex or Index

The latter solution itches me because you're doing the test for each row, even after you switched. Note it will also fail if there's no name starting with an L in the output.

I'd do something like:

while (my $row = $dbh -> fetchrow_arrayref) { if ($row -> [$last_name_col] =~ /^[L-Z]/) { push @L_Z => $row; while (my $row = $dbh -> fetch_arrayref) { push @L_Z => $row; } last; } push @A_K => $row; }