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" ){
...
--
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/