in reply to loop not ending...

Just a thought, or a pointer, hope you dont mind.
Use references instead of a redundant join / split combination, that way if your data ever contains commas, it won't end in tears...
And ->arrayref is theoretically faster than ->array.
And you're using less variables up.
while (my $personref = $sth->fetchrow_arrayref()) { # take copy of data in array ref push @certified_people, \@{ $personref }; } # stuff .. for (@certified_people) { my ($fname,$lname,$sc_id) = @{ $_ }; #stuff.... }