Help for this page

Select Code to Download


  1. or download this
    sub get_captures {
        my ($pattern, $line) = @_;
    ...
        shift(@captures) if !$#+;
        return @captures;
    }
    
  2. or download this
    sub get_captures {
        my ($pattern, $line) = @_;
        my @captures = $line =~ m/$pattern/;
        return @captures[0 .. $#+ - 1];
    }
    
  3. or download this
    sub get_captures {
        my ($pattern, $line) = @_;
    ...
        shift(@captures);
        return @captures;
    }
    
  4. or download this
    sub get_captures {
        my ($pattern, $line) = @_;
        my @captures = $line =~ m/($pattern)/;
        return @captures[1..$#captures];
    }