$ perl -l use warnings; use strict; my $x = "hey dude what's up"; (my $y = $x) =~ s/(\w+).*/$1/; print $y; __END__ hey