in reply to Re: Bizarre copy of ARRAY
in thread Bizarre copy of ARRAY

The 'g' is not superfluous; it's wrong (i.e. buggy, can cause errors). 'g' in scalar context is almost always wrong.

Replies are listed 'Best First'.
Re^3: Bizarre copy of ARRAY
by Anonymous Monk on Mar 20, 2011 at 08:17 UTC

    BTW,what are x,m,g,s for?I am using it because I saw it somewhere and thought its useful

      See perlop, and likely perlretut and perlre while you're at it. "Seeing things somewhere" is a good start, but you should read up on the documentation what things mean instead of blindly using them.

      • 'x' affects how whitespace and '#' behave.
      • 'm' affects how "^" and "$" behave.
      • 's' affects how "." behaves.

      See perlre for details on the above (since they affect regex patterns) and see perlop for 'g' (since it's affects the substitution operator).