Help for this page
sub words_before { my ( $word, $string ) = @_; ... my $words_before = () = $before =~ m/(\S+)/g; return $words_before; }
print 'There are ' . words_before( $word, $string ) . ' words before " +' . $word . '" in the string "' . $string . '"' . "\n";