Help for this page

Select Code to Download


  1. or download this
    $data =~ /^(?:(\d+)\s*(?{ push @results, $^N }))+$/;
    
  2. or download this
    my @results;
    while (<DATA>) {
    ...
    1 2 3 4 5
    2 3 4 5 6
    3 4 5 6 7
    
  3. or download this
    line 1: 1-2-3-4-5
    line 2: 2-3-4-5-6
    line 3: 3-4-5-6-7
    
  4. or download this
    while (<DATA>) {
        my @results;
        /^(?:(\d+)\s*(?{ push @results, $^N }))+$/;
        print "line $.: ", join('-', @results), "\n";
    }
    
  5. or download this
    line 1: 1-2-3-4-5
    line 2: 
    line 3: