If you use variables as 'constants', and you want to use them in a package, they should be defined in a BEGIN block inside the package, which (I think) is run as soon as the package is parsed by Perl.
package Map;
{
use Carp;
local ($s);
BEGIN {
$s = sqrt(2);
}
}
I think this is the same problem I recently came across here - if you define your 'constants' in the outermost scope of the package, you won't find them set when your script runs. It seems like they get re-initialised to undef at some point after they're defined.
(Btw in modern versions of Perl the 'use constant' pragma is a much better way of defining constants.)
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 )