#! perl -slw use strict; use Data::Dump qw[ pp ]; $Data::Dump::WIDTH = 50; my %hash = do{ local $/; } =~ m[(TAG\d=)\s+(.+?)(?=TAG|\Z)]gsm; pp \%hash; __DATA__ TAG1= data TAG2= more data TAG3= even more data that sometimes has = and runs on to more than one line TAG4= still more #### c:\test>junk15 { "TAG1=" => "data\n", "TAG2=" => "more data\n", "TAG3=" => "even more data that sometimes has = and\nruns on to more\nthan one line\n", "TAG4=" => "still more", }