Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
which works perfectly:
use strict; my $string='foo1bar'; print "BEFORE: [$string]\n"; $string =~ s/(.*)\d/$1---/; print "AFTER: [$string]\n";
But that did not work as I hoped:
use strict; my $string='foo1bar'; my $search='(.*)\d'; my $replace='$1---'; print "BEFORE: [$string]\n"; $string =~ s/$search/$replace/; print "AFTER: [$string]\n";
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Get a Perl script to return content from a module||7||84|
|PHP/REGEX: Where file names do not have underscore with glob||8||65|
|Regex - Capture everything between two strings.||8||46|
|octal error in perl program||3||42|
Join the community of 500,000 technology professionals and ask your questions.