fork download
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use feature 'say';
  5.  
  6. # Capture the number, and use a back-reference in the {} to define how many characters to match
  7. my $myString = "1abc3cdfg\n";
  8. $myString =~ s/(\d+)(??{ ".{$^N}" })//g;
  9. say $myString;
Success #stdin #stdout 0.01s 5536KB
stdin
Standard input is empty
stdout
bcg