On 12-04-15 01:44 PM, Вячеслав Агапов wrote:
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use 5.010;
use IO::Compress::Gzip;
use IO::Uncompress::Gunzip;
my %count = ();
my $file = "log.gz";
my $ungzip = new IO::Uncompress::Gunzip($file);
@arr = grep/work/,<$ungzip>;
foreach my $text (@arr) {
@arr1 = split / /,$text;
@sort = ($arr1[3],$arr1[4]);
say "$sort[0] => $sort[1]";
$count{$sort[0]}{$sort[1]} ++;
}
for my $k1 ( keys %count ){
for my $k2 ( keys %{ $count{$k1} }){
print "$k1 - count of $k2($count{$k1}{$k2})\n";
}
}
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
[updated for today's programmers]
"Show me your code and conceal your interfaces, and I shall continue
to be mystified. Show me your interfaces, and I won't usually need
your code; it'll be obvious."
-- Fred Brooks
Don't be clever; being great is good enough.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/