You left the /e off the regex:
use strict; use warnings; my @a = ('b' .. 'j'); my $str = 'a' x 23; $str =~ s/a/$a[rand@a]/ge; print "$str\n";
Prints:
dbjgcegjgieigecihebhdih
Oh, and don't use $a as a general purpose variable - it's magical ;)
In reply to Re: randomizing global replacement
by GrandFather
in thread randomizing global replacement
by lokiloki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |