in reply to parsing file/regex question

I'm assuming that the '\n' in DATA are actually new lines.

Maybe something like this is what you want:
my $re = qr/\[\s*([-a-zA-Z0-9_.*\s]+)\s*\]/; my ($last); while (<DATA>) { chomp; $_ = $last.$_ if($last); if (/$re/){ print "yep\n"; $last = ''; }elsif(substr($_, -1, 1) ne ']'){ $last = $_; }else{ $last = ''; } } __DATA__ [TEST DATA] [ TEST DATA ]

- Tom