if ( $seen{ $elem } ) { next; # skip to the next loop iteration } else { $seen{ $elem } += 1; }