Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!uvaarpa!mmdf From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.perl Subject: Puzzle Message-ID: <1991Apr1.224210.28384@uvaarpa.Virginia.EDU> Date: 1 Apr 91 22:42:10 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: worley@compass.com Organization: The Internet Lines: 24 The following program: $f = '/usr'; $a = ($f =~ m#/usr($|/)#); $b = ($f =~ m#${f}($|/)#); print "\$a = '$a'\n"; print "\$b = '$b'\n"; produces the output: $a = '1' $b = '' Why are the two apparently similar pattern matches doing different things? Is ${f} absorbing the following parenthesized pattern as a subscript? If so, how is it succeeding, since "$|/" is not a valid expression? Am I going crazy? Dale Dale Worley Compass, Inc. worley@compass.com -- If you live to a ripe old age and get what you want, you probably aren't a fool. -- Walter M. Miller, Jr.