#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @data; # Das Array, das Du schon erzeugst my %id_count; # Hash: zu jeder ID (die Zahlen am Zeilenanfang) die Anzahl der Vorkommen while (my $row = ) { chomp $row; push @data, $row; my ($id) = ($row =~ /^(\d+)/); $id_count{$id}++; } print Dumper \%id_count; __DATA__ 3681 OUT 2014-05-06 12:57:05 22 30 3338359406 3338753402 unkown 8414 3681 OUT 2014-05-06 12:39:44 37 43 3338359406 3338753402 unkown 8414 3681 OUT 2014-05-06 11:56:15 191 210 3338359406 3338753402 unkown 3991110 3681 OUT 2014-05-06 12:06:15 0 10 3338359406 3338753402 unkown 033372270 5494 OUT 2014-05-06 06:25:48 149 172 3375550834 X international 0038763931307 5494 OUT 2014-05-06 07:43:49 419 443 3375585134 X international 0038763649266 5494 OUT 2014-05-06 11:41:07 127 141 3375585134 X international 002207733514 5494 OUT 2014-05-06 08:54:48 252 259 3375550834 X international 00447589972757 5494 OUT 2014-05-06 01:28:17 0 11 3375585133 X international 0023221350752 5494 OUT 2014-05-06 11:41:15 121 133 3375550834 X international 0022062892015 5494 OUT 2014-05-06 01:28:25 0 10 3375585133 X international 005331997555 5494 OUT 2014-05-06 01:28:39 0 12 3375585133 X international 002392204144 5494 OUT 2014-05-06 08:15:03 0 14 3375585133 X international 0038763456569 5494 OUT 2014-05-06 08:15:02 0 14 3375585134 X international 0038763649266 5494 OUT 2014-05-06 11:41:09 122 131 3375585133 X international 0022062892015 5494 OUT 2014-05-06 08:14:36 0 14 3375585134 X international 0038763649266 5494 OUT 2014-05-06 01:29:00 0 10 3375585133 X international 0037125050148 7787 OUT 2014-05-06 04:06:37 125 132 3376290890 X international 00447589972819 7787 OUT 2014-05-06 04:06:51 124 131 3376290890 X international 00447589972819 7787 OUT 2014-05-06 04:06:58 127 134 3376290890 X international 00447589972819 7787 OUT 2014-05-06 07:24:22 121 128 3376290890 X international 00447589972819 7787 OUT 2014-05-06 08:44:07 126 133 3376290890 X international 00447589972819 7787 OUT 2014-05-06 04:07:26 119 126 3376290890 X international 00447589972819 7787 OUT 2014-05-06 04:07:40 122 129 3376290890 X international 00447589972819 7787 OUT 2014-05-06 10:48:55 127 146 3376290890 X international 002207396071