this post was submitted on 10 Sep 2023
65 points (93.3% liked)
Technology
59669 readers
3549 users here now
This is a most excellent place for technology news and articles.
Our Rules
- Follow the lemmy.world rules.
- Only tech related content.
- Be excellent to each another!
- Mod approved content bots can post up to 10 articles per day.
- Threads asking for personal tech support may be deleted.
- Politics threads may be removed.
- No memes allowed as posts, OK to post as comments.
- Only approved bots from the list below, to ask if your bot can be added please contact us.
- Check for duplicates before posting, duplicates may be removed
Approved Bots
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yes, exactly. Those definitions aren't clashing, so they must have separate namespaces.
I wouldn't do that either, but my colleage apparently did. So far I'm having a harder time reading perl than writing it.
The way it works is that there's a symbol table entry for "foo" which has a slot for a hash, scalar, array, glob, etc.
That leads to some super weird behaviour like, for example, if I declare a scalar, hash and array as "x":
You can access them all independently as you're aware:
But what's really going to bake your noodle is I can assign the "x" symbol to something else like this:
..and then the same thing works with z:
Oneliner if you want to try it:
Congratulations! You now know more about one of Perl's really weird internals than I'd wager most Perl programmers (I have literally never used any of the above for anything actually productive!)