sub _split_options { my ($self, $opts) = @_; while (my ($k, $v) = each %$opts) { print "$k = $v\n"; } while (my ($k, $v) = each %$opts) { print "$k = $v\n"; } # ... another code }