in reply to Find First character of each word in a string
perl -e 'my $foo="Internal computing\n department."; while ($foo =~ /(\w+)/g) {print substr($1, 0,1)."\n";}'
prints:
I
c
d
Note that the /g qualifier is critical. (If this modifier is omitted, the program will loop endlessly, printing “I.”) Also review the meanings of the /s, /p, and /m qualifiers, and of the “?” (“non-greedy”) symbol in the pattern string. Ponder this: “pos($foo) = undef;.”
The answer is: “regular expressions.”
Now then, what’s the question?