use strict; use warnings; my @differenthtml; $/="htmlpagemark"; while (){ chomp; next if $_ eq "htmlpagemark"; next unless length($_) > 0; push @differenthtml, $_; } for my $item (0..$#differenthtml){ print "===Item $item ==\n$differenthtml[$item]\n" } __DATA__ htmlpagemark http://finance.yahoo.com #/q/hp?s=%5EDJI&d=10&e=8&f=2012&g=d&a=0&b=2&c=199 +2&z=66&y=5214 # # It also consists of a lot of more text before the next #"h t m l p a g e m a r k" htmlpagemark http://another/URL More text #sorry if this question reveals to be noobish and simple #but i have no idea how to solve this issue + the= #contents of a read text file END