sub dopack { foreach my $i ( 0..$#data ) { my $line=$data[$i]; my ($jcpu,$j,$s)=(unpack('@2A16A40A232A16', $line))[0,1,3]; warn "$jcpu $j $s"; # ..store the values in a hash, but that is not important here } }