in reply to Re: Interrogating stashes - Camel example doesn't work?
in thread Interrogating stashes - Camel example doesn't work?

stevieb began his expository goodness with:

You're close, but you have to dereference the symbol table entry appropriately, not use it directly as a local variable. The array/hash doesn't get magically created

I see! I wonder if something has changed in how Perl parses such things, since, as I mentioned, the example was virtually verbatim from The Divine Book of All Things Perlish (the "Camel"). Whatever the case, your assistance caused me to become enlightened and was very appreciated. I've incorporated this dereferencing technique in code in a module I'm working on.

    - Soren

Jul 28, 2025 at 00:42 UTC

  • Comment on Re^2: Interrogating stashes - Camel example doesn't work?

Replies are listed 'Best First'.
Re^3: Interrogating stashes - Camel example doesn't work?
by hossman (Prior) on Jul 29, 2025 at 22:57 UTC

    You are getting different results, because you are using strict & warnings -- neither of which are enabled in the original sample code in the book....

    foreach $symname (sort keys %main::) { local *sym = $main::{$symname}; print "\$$symname is defined\n" if defined $sym; print "\@$symname is nonnull\n" if @sym; print "\%$symname is nonnull\n" if %sym; }
Re^3: Interrogating stashes - Camel example doesn't work?
by hippo (Archbishop) on Jul 28, 2025 at 09:55 UTC
    the example was virtually verbatim from [the Camel Book]

    Perhaps it would be a good exercise to try it actually verbatim? That way you will be enlightened as to whether something has indeed changed or if it was just your tweaks which have caused the problem.


    🦛