You would use regular expressions. (Please read this as: you didn't provide your attempts, just your restrictions. As far as we can tell, this is a homework assignment.)
$string =~ m:|(\w+)\.(\w+):; $extracted = "$2 $1";
(No, that's not quite what you're after, but it should be close enough that you can work from here - if you have more problems, please come back.)
In reply to Re: Extracting names from string
by Tanktalus
in thread Extracting names from string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |