blabla:(123):falleriefallera dingdong moep blubb 4711 dingdong blob))hop((gob))sob((0815))ding knickknack boing 44 nothing here blabla:(123):falleriefallera dingdong moep blubb 471 dingdong blob))hop((gob))sob((0815))ding knickknack boing 45 nothing here too blabla:(1344):falleriefallera dingdong moep blubb 4711 dingdong blob))hop((gob))sob((0815))ding knickknack boing 46 nothing again blabla:(123):falleriefallera dingdong moep blubb 4711 dingdong blob))hop((gob))sob((0825))ding knickknack boing 47 #### use strict; use warnings; # 1. get file and stuff it into an array # that what it will be in target code open FILE, 'target.txt' or die "nope dude: $!"; my @stuff; while(){ chomp $_; push @stuff, $_; } print "reading done "; # 2. make a long line out of it # because I still have problems using an array for this :( my $longline; foreach my $x (@stuff){ $longline .= $x; } # 3. get all matches and place them in an array array x) my @super; while ($longline =~ /\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)/g){ my @sub = ($1, $2, $3, $4); push @super, \@sub; } # 4. we should have four entries in that @super print scalar @super, "\n"; #### 0 ARRAY(0x1f08820) 0 123 1 4711 2 0815 3 44 1 ARRAY(0x2199678) 0 123 1 471 2 0815 3 45 2 ARRAY(0x21994e0) 0 1344 1 4711 2 0815 3 46 3 ARRAY(0x219f128) 0 123 1 4711 2 0825 3 47