#!/usr/local/bin/perl ############################ use strict; use warnings; use Fcntl qw/O_RDONLY O_WRONLY O_CREAT O_EXCL/; my $file = 'testinput.txt'; my $tmp = 'output.txt'; sysopen(INPUT, $file, O_RDONLY) or die "unable to open the input file"; #Datei wird systemnah, nur zum Lesen, geƶffnet sysopen(OUTPUT, $tmp, O_WRONLY | O_CREAT) or die "unable to open job2.inp: $!"; while(my $test = ) { print OUTPUT $test; if ($test =~/(anderer text)\n((\s*[0-9]*,)*(\s*[0-9]*)\n)*/) { print "okay, passt\n"; while($test = ) { if ($test =~/(testende)/) { print OUTPUT "das ist der text \n"; print OUTPUT $test; print "jetzt steht was drin"; } } } } close (INPUT); close (OUTPUT);