http://www.perlmonks.org?node_id=682581

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hey guys, I have a string $x in a scalar, and I need to copy the first 'word' of string to $y and I can't seem to find anywhere how to do it. I know that \w would be the regex for a 'word' and know how to match it, but how do I capture it in another variable without having to split the whole string then just copy $x[0]. Many thanks, Bill