carric has asked for the wisdom of the Perl Monks concerning the following question:
I am getting various errors, but nothing helpful in spite of using "perl -w". I am using the $flip var so I don't change the value of $_ ( I want to do some more stuff later on with it, and I want to stay the same throughout.. probably a better way to do that too, but we only know what we know). Can I not call $1 in my search and replace?? It never seems to work right. It does seem to work if I copy $1 to another var and then use that in my regexp.. I really need to sit down with my "Mastering Regular Expressions" book and quit pestering you guys. =)for (@words) { while(/(.)/g) { $flip = $_; $flip =~ s/$1\./\.$1/ge; # flip match + next char print $flip; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: YET another regexp puzzle
by Coruscate (Sexton) on Nov 20, 2003 at 02:35 UTC | |
by carric (Beadle) on Nov 20, 2003 at 03:08 UTC | |
|
Re: YET another regexp puzzle
by Roger (Parson) on Nov 20, 2003 at 03:11 UTC | |
by carric (Beadle) on Nov 20, 2003 at 03:12 UTC | |
|
Re: YET another regexp puzzle
by Abigail-II (Bishop) on Nov 20, 2003 at 10:41 UTC | |
|
Re: YET another regexp puzzle
by duff (Parson) on Nov 20, 2003 at 04:48 UTC | |
|
Re: YET another regexp puzzle
by Coruscate (Sexton) on Nov 20, 2003 at 05:20 UTC | |
|
Re: YET another regexp puzzle
by Anonymous Monk on Nov 20, 2003 at 01:50 UTC | |
by carric (Beadle) on Nov 20, 2003 at 02:33 UTC |