in reply to Re^2: Sorting file rows and copy them in an array in thread Sorting file rows and copy them in an array
- /g means "global". See perlop as already hinted.
The /g modifier specifies global pattern matching—that is, matching as many times as possible within the string. How it behaves depends on the context. In list context, it returns a list of the substrings matched by any capturing parentheses in the regular expression. If there are no parentheses, it returns a list of all the matched strings, as if there were parentheses around the whole pattern.
- (...)[0] returns the first (zeroth) element of the list. Therefore, the construct enforces list context on the contents of the parentheses.
|