# Before loop: my %is_account; $is_account++ for @accounts; ... # In loop: push .... if !$is_account{$username};