RE match problem in Perl 2.0 pl 18
Johan Vromans
jv at mh.nl
Fri Aug 25 08:37:06 AEST 1989
Perl version:
$Header: perly.c,v 2.0.1.10 88/11/22 01:14:58 lwall Locked $
Patch level: 18
Using a regular expression in a match pattern seems to destroy the
usability of the "$`" (dollar-leftquote) variable:
$a = "abcdefghi";
printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /def/;
printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /d.f/;
printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /^abc/;
printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /ghi$/;
produces:
$` = abc, $' = ghi
$` = , $' = ghi <== $` should be "abc"
$` = , $' = defghi <== could be correct...
$` = , $' = <== $` should be "abcdef"
--
johan
--
Johan Vromans jv at mh.nl via internet backbones
Multihouse Automatisering bv uucp: ..!{mcvax,hp4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62944/62500
------------------------ "Arms are made for hugging" -------------------------
More information about the Comp.sources.bugs
mailing list