http://qs321.pair.com?node_id=682585


in reply to First word

$ perl -wle 'print shift =~ /^(\w+)\b/' "That's my sentence." That

As you can see, \w matches a word character, and \b marks the end of the first word (since we're matching the beginning aka ^ of the string).

More information at perlre.

-- Frank

Replies are listed 'Best First'.
Re^2: First word
by grizzley (Chaplain) on Apr 24, 2008 at 09:49 UTC
    You don't need \b because \w+ is greedy.