in reply to Re^2: 'grouping' substrings?
in thread 'grouping' substrings?

Sorry to bother you again, but it doesn't seem to work. For example, the first group gives 5-16, while it should be 5-15, the second 32-45, while it should be 32-44 from what I can calculate... Are my maths poor??? Also, I can't understand what [$-[0], $+[0]] mean... Any tips ? Sorry, I'm just beggining Perl...

Replies are listed 'Best First'.
Re^4: 'grouping' substrings?
by kwaping (Priest) on Feb 01, 2006 at 16:25 UTC
    I hope this isn't too obvious, but how about subtracting one from $+[0]?

    Updated per ikegami's reply - duh! I have a bad track record lately...
      --$+[0] doesn't work ("Modification of a read-only value attempted"), but $+[0] - 1 will.
Re^4: 'grouping' substrings?
by ikegami (Patriarch) on Feb 01, 2006 at 17:04 UTC

    [ ... ] means "Construct an array with '...' as content, and return a reference to it." This is documented in perlref.

    $-[0] and $+[0] are elements of the special arrays @- and @+. Refer to perlvar for more information.