while(($key, $msg) = each %$msg) { process_msg($bs,$msg); }