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 )

Thursday, February 21, 2013

Perl m// grouping context

m// always returns an array when used with () matches, even if there is only one match. Eg you must say

@a = m/Time (L...)/;

($a) = m/Time (L...)/;

If you assign just to $a in this situation, you'll get the scalar value of the array of matches, in this case 1.

Don't be fooled by testing it with print. print takes a list as its argument - it concatenates all its elements and then prints the result - so it's equivalent to the @a example.

Followers

Blog Archive