in reply to Problem in printing lastname and firstname

Addendum to the previous posts. Read perlre, read split.

To split on any amount of whitespace, use a regular expression:

($fn,$ln) = split(/\s+/,$input);

Note that you'll get only the first two words without the third argument to split - the number of fields you want to split into:

$input = "foo bar blurf"; ($f,$s) = split /\s+/, $input; print "<$f> <$s>\n" __END__ <foo> <bar>
$input = "foo bar blurf"; ($f,$s) = split /\s+/, $input, 2; print "<$f> <$s>\n" __END__ <foo> <bar quux>

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}