On Tue, 2008-09-02 at 10:43 -0400, Mr. Shawn H. Corey wrote: > On Tue, 2008-09-02 at 05:35 -0700, John W. Krahn wrote: > > It also doesn't work if there is whitespace between the operator name > > and the delimiter, for example: 'm / abc /x' or 's / abc /def/x'. > > > > Or if the delimiter is part of the pattern, for example: 'm/..\/..\/../'. > > > > Or if the /e option is used with the substitution operator. > > > > (Or perhaps if the user wants to use tr/// instead of m// or s///?) > > You can separate everything without relying on parsing the s format: > > print "Enter pattern "; > chomp( my $rexp = <STDIN> ); > print "Enter replacement string "; > chomp( my $replacement = <STDIN> ); > print "Enter substitute flags "; > chomp( my $flags = <STDIN> ); > > while( eval "$text =~ s/$rexp/$replacement/$flags" ){
Sorry, it's Tuesday after a long weekend; brain is not fully in gear yet. Try: while( eval "\$text =~ s/$rexp/$replacement/$flags" ){ -- Just my 0.00000002 million dollars worth, Shawn "Where there's duct tape, there's hope." Cross Time Cafe "Perl is the duct tape of the Internet." Hassan Schroeder, Sun's first webmaster -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/