Help for this page

Select Code to Download


  1. or download this
    my $str = "a2b c34d";
    $str =~ /(\D\d\D)/;
    print "$1\n";       # prints: 'a2b'
    $str =~ s/$1/NEW/;
    print "$str\n";     # prints: 'NEW c34d'
    
  2. or download this
    my $str = "a2b c34d";
    $str =~ /(\D\d\D)/;
    print "$1\n";       # prints 'a2b'
    $str =~ /(xyz)/;
    print "$1\n";       # prints 'a2b' again