top | item 28949394 (no title) chromatic | 4 years ago No need to copy and then replace: my $a = 'Perl'; my $b =~ s/pe/ea/ir; discuss order hn newest petre|4 years ago Doesn't work. You don't assign anything to $b, so it's undef: % perl -MData::Dumper=Dumper -e 'my $a = 'Perl'; my $b =~ s/pe/ea/ir; print Dumper $b;' $VAR1 = undef; You probably mean: my $a = 'Perl'; my $b = $a =~ s/pe/ea/ir; Anyway, thank you for the /r modifier, it didn't know what it did, since there's no example in perlre(1). chromatic|4 years ago You're right, that's exactly what I meant!I'm surprised there's no example in perlre(1); perhaps I can get that corrected.
petre|4 years ago Doesn't work. You don't assign anything to $b, so it's undef: % perl -MData::Dumper=Dumper -e 'my $a = 'Perl'; my $b =~ s/pe/ea/ir; print Dumper $b;' $VAR1 = undef; You probably mean: my $a = 'Perl'; my $b = $a =~ s/pe/ea/ir; Anyway, thank you for the /r modifier, it didn't know what it did, since there's no example in perlre(1). chromatic|4 years ago You're right, that's exactly what I meant!I'm surprised there's no example in perlre(1); perhaps I can get that corrected.
chromatic|4 years ago You're right, that's exactly what I meant!I'm surprised there's no example in perlre(1); perhaps I can get that corrected.
petre|4 years ago
chromatic|4 years ago
I'm surprised there's no example in perlre(1); perhaps I can get that corrected.