Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: The default hash - accident, coincidence or conspiracy?

by Animator (Hermit)
on Jun 20, 2005 at 12:03 UTC ( #468294=note: print w/replies, xml ) Need Help??

in reply to The default hash - accident, coincidence or conspiracy?

The question should not be 'will it be supported', the question should be: 'do you want to use it'?

It's a real global variable, it lives in the main/default symbol table, you can not lexicalize it, and more important, every file and package can modify it.

Especially the last point will make it hard to maintain and/or modify and/or integrate it with other programs.

This is ofcourse all true for $_ and @_, but do you really rely on them having a certain value? I certainly do not.

Also note that there is no point to have a 'default' hash. You can create a package-global hash (%config for example) which you can access from other packages by including the package name. And if you are not happy with that then you can even import it in other packages.

Replies are listed 'Best First'.
Re^2: The default hash - accident, coincidence or conspiracy?
by SimonClinch (Deacon) on Jun 20, 2005 at 12:18 UTC
    Thank you all for such prompt response -- already Animator's point about it being open to modification by any module has persuaded me (sigh) not to use it - pity in a way - it looked so inviting. (-S)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://468294]
[hippo]: Can anybody suggest a scalar value of $x for which ($x && !length $x) is true?
[Corion]: hippo: If you have a Unicode-wise Perl then likely some zero-width characters in $x would work. Maybe $x = "\x{200b}" works.
[Corion]: Hmm - no, that outputs 1 for me on 5.14 - perl -wle "my $x = qq(\x{200b}); warn $x; warn length $x"
[hippo]: Smart - I'll give that a go. Thanks.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2017-07-27 13:24 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (413 votes). Check out past polls.