WORKING #!/usr/bin/perl my $string = " info John 100 - 2000 Kent"; my $word = "info"; $string =~ /$word\s*?(\S+)/; my $next_word = $1; print "The next word after $word is $next_word\n";