in reply to First word


match a single word character/\w/
match a word /\w+/
match a word at the start /^\w+/
capture it /^(\w+)/
bind the pattern to a string $x =~ /^(\w+)/
assign captured word my ( $word ) = $x =~ /^(\w+)/

The parentheses around $word are important.

Update: Reformatted

Unless I state otherwise, my code all runs with strict and warnings