#!/usr/bin/perl -w

# An example showing how the quantifiers work with positional variables.
use strict;

my @strings;

$strings[0] = "one two three";
$strings[1] = "one two";
$strings[2] = "one";


foreach my $str (@strings) {

  if($str =~ /(\w+\s*){1,3}/ ) {
    # The following line doesn't do what we want. Since there
    # is only one set of parentheses, only $1 has a value
    # print "$1 $2 $3\n";
     print "$1\n";
  }else {
     print "Didn't match\n";
  }
}



