while( ) { foreach ( split "" ) { (my $name) = $_ =~ /(\w+\s?\w.*)\<\/b\>/; print "$name\n" if ( defined( $name ) ); } }