mmartin has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I was trying to use the "/r" flag in a REGEX Search and Replace and I keep getting the error:
"Bareword found where operator expected at ./test.pl line 11, near "s/Matt/Matthew/r" "
For Example:
Was the Non-Destructive Flag "/r" not implemented in this version of Perl? If so, is it possible to get it without upgrading all of Perl..?
Thanks in Advance,
Matt
I was trying to use the "/r" flag in a REGEX Search and Replace and I keep getting the error:
"Bareword found where operator expected at ./test.pl line 11, near "s/Matt/Matthew/r" "
For Example:
The server it's running on has Perl Version 5.8.8.#!/usr/bin/perl use warnings; use strict; my $str; my $str2; $str = "Hello World I'm Matt"; $str2 = $str =~ s/Matt/Matthew/r; print " str = $str\n"; print "str2 = $str2\n";
Was the Non-Destructive Flag "/r" not implemented in this version of Perl? If so, is it possible to get it without upgrading all of Perl..?
Thanks in Advance,
Matt
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: REGEX Non-Destructive Flag
by toolic (Bishop) on Jan 10, 2012 at 17:42 UTC | |
by mmartin (Monk) on Jan 10, 2012 at 17:54 UTC | |
by MidLifeXis (Monsignor) on Jan 10, 2012 at 18:08 UTC | |
by i5513 (Pilgrim) on Jan 10, 2012 at 19:42 UTC | |
by toolic (Bishop) on Jan 10, 2012 at 19:53 UTC | |
Re: REGEX Non-Destructive Flag
by mmartin (Monk) on Jan 10, 2012 at 21:08 UTC | |
by quester (Vicar) on Jan 11, 2012 at 06:09 UTC | |
by mmartin (Monk) on Jan 12, 2012 at 16:27 UTC |
Back to
Seekers of Perl Wisdom