in reply to reading from a textfile

This will do it:

use Data::Dumper; + open(IN, "< myfile.txt") or die $! my $data_ok = 0; + while(<IN>) { chomp; + m/^\s*>\s*$/ and last; # stop when encountering that last ">". $data_ok and push @data, $_; # keep all data inbetween. m/Testnok/ and $data_ok = 1; # start after "Testnok". } print Dumper \@data;

Cheers, Sören