It pushes the first instance of each different item in @cn1_newnnn into the array @cn1_new and counts the number of repeats in %ss (assuming %ss is empty beforehand). Consider:
use strict; use warnings; my @cn1_new; my @cn1_newnnn = qw(apple orange grape apple lemon banana apple grape) +; my %ss; push(@cn1_new,grep {!$ss{$_}++} @cn1_newnnn); print "$_: $ss{$_}\n" for sort keys %ss; print "@cn1_new\n";
Prints:
apple: 3 banana: 1 grape: 2 lemon: 1 orange: 1 apple orange grape lemon banana
In reply to Re: meaning for the code
by GrandFather
in thread meaning for the code
by sanku
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |