Birgit Kellner wrote: > > use POSIX 'setlocale'; > use locale; > use strict; > use warnings; > setlocale( &POSIX::LC_ALL, "de" ); > my %rec; > $rec{'content'} = qq|<!-- start query --><input type=hidden name="227" > value="77"><dl><dt><dd>"Madhyamaka." In: "Buddhismus in Geschichte und > Gegenwart, Bd. I." Hamburg: Universität Hamburg (Weiterbildendes Studium) > 1998, 180-189.</dl><input type=hidden name="230" > value="77"><dl><dt><dd>"Zum Konzept der Leerheit im BCA." In: "Buddhismus > in Geschichte und Gegenwart, Bd. III: ZAntidevas "Eintritt in das Leben zur > Erleuchtung"." Hamburg: Universität Hamburg (Weiterbildendes Studium) 1999, > 61-80.</dl><input type=hidden name="229" value="77"><dl><dt><dd>"The > PrasannapadA: More Manuscripts from Nepal." 44 (2000), > 165-181.</dl><input type=hidden name="305" value="77"><dl><dt><dd>"Die > Sicht der Leerheit." Tibet und Buddhismus 52 (2000), 8-13.</dl><!-- > end query -->alkjd öslkfdj|; > > if ($rec{'content'} =~ /(<!-- start query -->.*?<!-- end query -->)/s) { > print "YES: there is content with query tags\n"; > my $query = "$1"; > print "QUERY\n---------------------\n$query\n-------------\n"; > $rec{'content'} =~ s/$query/!query!/s; > print "CONTENT AFTER CHANGE: $rec{'content'}\n"; > } > > Does anyone know why the substitution in the second line from the bottom is > not carried out? Does $rec{'content'} contain any illegal characters which > allow for regexp searching, but prohibit replacing?
Why not just put the substitution in the if statement? if ( $rec{'content'} =~ s/(<!-- start query -->.*?<!-- end query -->)/!$1!/s ) { print "YES: there is content with query tags\n"; print "QUERY\n---------------------\n$1\n-------------\n"; print "CONTENT AFTER CHANGE: $rec{'content'}\n"; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]