for( @data ) { ## use $_ to alias the lines my $p = -1; ## Allow pre-increment which is more efficient $freq{ chop() }[ ++$p ] += $inc while $_; ## implicit arg for chop; avoid call to length. }