#!/usr/bin/perl # http://perlmonks.org/?node_id=1200077 use strict; use warnings; my $string = 'Titles consisting of a single word are discouraged, and in most cases are disallowed outright.'; my @tags = split /\n/, <## Titles consisting of a single word are discouraged, and in most cases are disallowed outright. Titles (cat1: id1)consisting of(cat1) a single word are (cat1: id2)discouraged(cat1), and in (cat2: id3)most cases(cat2) are disallowed outright.