Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!noose.ecn.purdue.edu!mentor.cc.purdue.edu!mace.cc.purdue.edu!abe From: abe@mace.cc.purdue.edu (Vic Abell) Newsgroups: comp.lang.perl Subject: need help with {n} and bracketing Message-ID: <7171@mace.cc.purdue.edu> Date: 5 Apr 91 16:36:51 GMT Organization: Purdue University Lines: 22 The following Perl program: if ("one two three four\n" =~ /^((\w+\s+){3})/) { print '"', $1, "\" \"", $2, "\" \"", $3, "\" \"", $4, "\"\n"; } else { print "No match!\n"; } produces: "one two three " "three " "" "" I expected: "one two three " "one " "two " "three " Can anyone help me understand why the "((\w+\s+){3})" matching and bracketing expression didn't create four special Perl variables? It appears that only the final match of the thrice-matched inner part -- "(\w+\s+){3}" -- is being assigned to a special variable. Vic Abell