sub test5{ #with natatime use List::MoreUtils qw/natatime/; $href={}; open(my $fh, "<", "04_A10A10A4.ascii") or die $!; local $/= undef; my $lt = natatime(3, unpack( '(a10a10a4)*', <$fh>)); while( my @rec=$lt->() ){ push @{ $href->{ $rec[0] } }, [ @rec[ 1, 2 ] ] } close $fh; } sub test6{ $href={}; open(my $fh, "<", "04_A10A10A4.ascii") or die $!; local $/= undef; my $i=1; my($s1,$s2); map { $s1=$_ if $i % 3 == 1; $s2=$_ if $i % 3 == 2; if( $i % 3 == 0){ push @{ $href->{$s1} }, [$s2, $_]; } $i++; }unpack( '(a10a10a4)*', <$fh> ); close $fh; } sub test7 { my %hash=(); open(my $fh, "<", "04.txt") or die $!; while( <$fh> ) { my( $k, @v ) = unpack( 'a10a10a4', $_ ); push @{ $hash{ $k } }, \@v } close $fh; }