Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!mcnc!uvaarpa!mmdf From: telxon!ping!gorpong@uunet.uu.net Newsgroups: comp.lang.perl Subject: Need help with (\d+) problem (s/...(\d+)/$1/ not working?) Message-ID: <1990Nov4.224658.21882@uvaarpa.Virginia.EDU> Date: 4 Nov 90 22:46:58 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: telxon!ping!gorpong@uunet.uu.net Organization: The Internet Lines: 34 Something is a little strange either with the way that I am interpreting the manual page, or with Perl. The mini-script: $string = "this is a test of stuff\t95"; ($a = $string) =~ s/\w+\s+(\d+)/$1/; print "1 == $1\nA == $a\n+ == $+\nbefore == $`\nafter == $'\n"; Prints out: 1 == 95 A == this is a test of 95 + == 95 before == this is a test of after == I think it should print out: 1 == 95 A == 95 + == 95 before == this is a test of after == Why is 'a' not correctly being substituted? Or is it doing exactly what it should be doing, and I am the one confused? -- Gordon. -- Gordon C. Galligher 9127 Potter Rd. #2E Des. Plaines, Ill. 60016-4881 telxon!ping%gorpong@uunet.uu.net (not tested) (Is this even legal??) ...!uunet!telxon!ping!gorpong (tested) (And it works!) "It seems to me, Golan, that the advance of civilization is nothing but an exercise in the limiting of privacy." - Janov Pelorat -- _Foundation's Edge_