#!/usr/bin/perl -w my $string = ' Costly false alarms Mindless yobs terrorise OAPs Road deaths Twisted porn pervert caged for life Greenbelt homes plan appeal thrown out '; while ( $string =~ m!(]*>)(.+?]*>)!ig ) { print "1st match: $1 \n"; print "2nd match: $2 \n\n"; }