in reply to Find First character of each word in a string

DB<1> $str="Internal Computing Department" DB<2> print $str=~m/\b(\w)/g ICD

UPDATE

nota bene, the regex returned a list not a string!

if you want to uppercase it try uc after joining.

DB<15> $abbr= uc join "","internal computing department" =~ m/\b(\w) +/g DB<16> print $abbr ICD

Cheers Rolf

Replies are listed 'Best First'.
Re^2: Find First character of each word in a string
by AnomalousMonk (Archbishop) on Nov 24, 2010 at 01:20 UTC

    But:

    DB<3> print 'my cardio workout' =~ m/\b\w/g; mcw

    Maybe:

    DB<4> print map uc, 'my cardio workout' =~ m/\b\w/g; MCW

    Update: Oops: LanX beat me to the punch.

Re^2: Find First character of each word in a string
by kevyt (Scribe) on Nov 24, 2010 at 01:18 UTC
    Thanks