in reply to Re^2: Distinguishing between an array of objects and an array of strings
in thread Distinguishing between an array of objects and an array of strings

ok, nobody would call their classes '0', . . .

There is a good reason for that.

$ perl -e'package 0' syntax error at -e line 1, near "package 0" Execution of -e aborted due to compilation errors. $
Namespace names follow the same rules as variable names.

After Compline,
Zaxo

  • Comment on Re^3: Distinguishing between an array of objects and an array of strings
  • Download Code

Replies are listed 'Best First'.
Re^4: Distinguishing between an array of objects and an array of strings
by Anonymous Monk on Sep 22, 2005 at 12:41 UTC
    0 is a perfectly valid variable name. $0 is a well known variable - and @0 and %0 are valid as well. 0 is also valid as a package name - but like many other valid package names, you can't use it as an argument to package.
Re^4: Distinguishing between an array of objects and an array of strings
by diotalevi (Canon) on Sep 22, 2005 at 14:31 UTC

    No they don't. package declarations do, namespaces can be anything.

    *{ anything } = \ anything; bless ..., anything;
Re^4: Distinguishing between an array of objects and an array of strings
by friedo (Prior) on Sep 22, 2005 at 14:29 UTC
    my $pkg = "0"; my $o = bless { }, $pkg; print ref $o;