- or download this
my @b = grep EXPR, @a;
- or download this
my @b;
foreach (@a) {
...
push @b, $_;
}
}
- or download this
my @uniqueIPs;
foreach (@uniqueIPs) {
...
push @ipAddresses, $_;
}
}
- or download this
$x++
- or download this
my $orig_x = $x;
++$x;
$orig_x
- or download this
my @uniqueIPs;
foreach (@uniqueIPs) {
...
push @ipAddresses, $_; # save it
}
}
- or download this
my %counts;
my @uniqueIPs = grep !$counts{$_}++, @ipAddresses;
- or download this
my @uniqueIPs;
foreach (@uniqueIPs) {
...
push @ipAddresses, $_; # save it
}
}
- or download this
# Remove duplicates IP addresses by counting
# the number of times each address occurs.
my %counts;
my @uniqueIPs = grep !$counts{$_}++, @ipAddresses;
- or download this
# Remove duplicates IP addresses by counting
# the number of times each address occurs.
my %counts;
my @uniqueIPs = grep ++$counts{$_} == 1, @ipAddresses;