in reply to search and using first letter of words on a line

That's some pretty ugly HTML (both versions), so I'm going to hope there are some typos in it. You may want to use a module to parse that, or if the tags will always be the same, strip it out with a regex. But once you've got your title, you can get your acronym with something like this:

my $title = "Part II: Nietzsche's Project, An Overall Review"; my $acronym = join '', ($title =~ /(?:^|\s+)(\w)/g); say $acronym; # -> PINPAOR

That'll give you a string containing each word character that follows the start of the string or a group of whitespace characters. You could narrow \w further to just take capital letters or whatever you like.

Replies are listed 'Best First'.
Re^2: search and using first letter of words on a line
by Anonymous Monk on Sep 22, 2011 at 12:10 UTC

    <quote>That's some pretty ugly HTML (both versions), so I'm going to hope there are some typos in it.</quote>

    Yeap. Not as pretty as it could be, but very ideal for my situation. I need to make pages for phone (almost) as lean as possible while navigatable because the phon is old enough to struggle opening files larger than 50K.

    <quote>or if the tags will always be the same, strip it out with a regex.</quote>

    Exactly. The tags in any given document will be the same, but the heading title words from which I want to strip the first letter to make link href and name are different, so it needs to find first letter of words and combine them for link ids. Then I use sed to create my TOC at the top of the page. appreciate a kick in the right direction. nap

      Does your phone understand CSS? That could make the resulting code a lot leaner, if you could specify your smaller font size once instead of with a font tag on every paragraph.

      /* in the <head> of the page */ <style type='text/css'> p { font-size:.7em; /* or whatever works */ } </style>