in reply to variables with colons
Why does Perl think I'm trying to use a variable $typ:: when I can't ever declare $typ:: anyways?
You can't declare $1 or $Module::foo either, so that's a bad criteria for defining what's a variable.
%typ:: is a valid variable (the symbol table for package typ), so the name typ:: is necessarily valid.
$ perl -le'$typ="abc"; $dat="def"; $typ::="123"; print "$typ::$dat"' 123def
Workarounds:
$ perl -le'$typ="abc"; $dat="def"; $typ::="123"; print "${typ}::$dat"' abc::def
$ perl -le'$typ="abc"; $dat="def"; $typ::="123"; print "$typ\::$dat"' abc::def
$ perl -le'$typ="abc"; $dat="def"; $typ::="123"; print $typ."::".$dat' abc::def
|
|---|