Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )
Tuesday, October 16, 2012
m// notes and easy mistakes
m// returns true or false in scalar context, not a character position or a match count!
In array context you get an array of matching strings - even if there is only 1 match, it's an array of 1 element.
m//g is different - it has state, and in scalar context will return true or false as many times as there are matches. Obviously it will only do this if invoked multiple times, eg in a while loop. In array context you get an array (obviously) as above.