return (split " ", shift)[0];
Or, if you want:
(split " ", shift)[0];
(The result of the last line of a sub implicitly becomes the return value).
Even shorter (Perl 5.16 required for /r
option):
$_[0]=~s/ .*//r
Of course, in actual production code, your original example is better, since it's readable.