Help for this page

Select Code to Download


  1. or download this
        $sss = "M9";
        $sss =~ m/(\d+)/;
            print $1;    # -->  prints 9
    ...
        $sss = "Mm";
        $sss =~ m/(\d+)/;
        print $1; #-->  still prints 9
    
  2. or download this
        $sss = "M9";
        if ($sss =~ m/(\d+)/ && $1 ne undef){
            print "Value Matched on: $1";    # prints Value Matched on: 9
    ...
        if ($sss =~ m/(\d+)/ && $1 ne undef){
            print "Value Matched on: $1";    # if statement is not entered
    +; prints nothing
        }
    
  3. or download this
        $sss = "9 9";
        if ($sss =~ m/(([A-Za-z]*)(\d*)/ && $1 ne undef){
            print "Value Matched on: $1";    # if statement is not entered
    +; prints nothing
        }