#!/usr/bin/perl use strict; my $string = 'to test me'; $string =~ /to\s(\w+)\s/; print $1;