eval.in

Paste #47144

Perl — Perl 5.16.1, pasted 7 months ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl
use warnings;
use strict;

my $input = "
A    4481676    4483063
A    4481676    4483063
A    4481676    4483063
A    4481676    4483063
A    4483214    4483749
A    4483214    4483749
A    4483214    4483749
A    4483214    4483749
A    4483214    4483749
A    4483214    4483749";

my %seen;

while($input =~ /(.+)$/mg ){
    $seen{$1}++;
}

foreach my $key (keys %seen) {
    print "$key   $seen{$key}\n";
}

Program Output

A    4483214    4483749   6
A    4481676    4483063   4

OK (0.008 sec real, 0.007 sec wall, 9 MB, 113 syscalls)

Fork