use strict; use warnings; my $str = < DATA open IN, '<', \$str || die "\nCan't open test.in\n $!\n"; local $/ = ''; while () { my @avalues = /="([^"]+)"/g; next unless @avalues; print "New Group: @avalues\n"; } close (IN); #### New Group: ref1 ref2 ref3 New Group: ref4 ref5 New Group: ref6 ref7 ref8