Are you looking for something like:
$sth->bind_columns( undef, \$orig_service_id, \$orig_stop, $depart_ori +g); while ($sth->fetch()) { $ids{$orig_service_id} = { stop_reference => $orig_stop, depart_time => $depart_orig, } }
If you use that system, then you can write something like:
$sth->bind_columns( undef, \$dest_service_id, \$dest_stop, $depart_des +t); while ($sth->fetch()) { if (exists ($ids{$dest_service_id}) { print "ID $id exists in both origin and destination set\n"; print "\t$ids{$dest_service_id}{stop_reference} => $dest_stop\ +n"; print "\t$ids{$dest_service_id}{depart_time} => $depart_dest\n +"; } }
Update: Typo fixed, thanks to johngg.
In reply to Re: Keeping associated data after entering into a hash
by chromatic
in thread Keeping associated data after entering into a hash
by Harch84
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |