Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Syntax Question Related to "join" on a Complex Data Structure

by haukex (Archbishop)
on Oct 26, 2016 at 14:28 UTC ( [id://1174784]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Syntax Question Related to "join" on a Complex Data Structure
in thread Syntax Question Related to "join" on a Complex Data Structure

Hi perldigious,

What slightly surprised me is that the 3rd line above (with the leading %) gives the key value pairs and not just the values

Key/Value Hash Slices were added in Perl v5.20 (the rest of the Slices doc is probably worth a read too).

Hope this helps,
-- Hauke D

  • Comment on Re^3: Syntax Question Related to "join" on a Complex Data Structure

Replies are listed 'Best First'.
Re^4: Syntax Question Related to "join" on a Complex Data Structure
by BrowserUk (Patriarch) on Oct 26, 2016 at 16:18 UTC
    Key/Value Hash Slices were added in Perl v5.20 (the rest of the Slices doc is probably worth a read too).

    Thanks for mentioning that here; as to my knowledge that is the first time it has been.

    It had gone completely under my radar; and -- along with the index/value array slices -- looks to be a really useful addition.

    IMO that is probably the most useful addition since they added defined-OR back in 5.10.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.

      ...along with the index/value array slices -- looks to be a really useful addition.

      I agree with that sentiment. When you had me go back and look at the index/value array slice as well my brain started pondering on all the code I've written in the past year that I could have written to exploit that and $virtue_of_laziness++.

      I love it when things get difficult; after all, difficult pays the mortgage. - Dr. Keith Whites
      I hate it when things get difficult, so I'll just sell my house and rent cheap instead. - perldigious
Re^4: Syntax Question Related to "join" on a Complex Data Structure
by perldigious (Priest) on Oct 26, 2016 at 15:01 UTC

    Thanks haukex, appreciate the links to the perldata doc. I usually can only get where I need to be in the docs via a Google search. Everything I know about slices I picked up from the last chapter of "Learning Perl 6th Edition", which only briefly points out that it can be done on arrays and hashes and the basics of how to do it. I'm pretty sure that's where I picked up the @gimme_this_slice_of_values{ @for_this_list_of_keys } trick. It's not like they could dive too deep in to usage on more complex data structures that would require dereferencing, and since they wrote that book under Perl 5.14 the Key/Value Hash Slice variation wasn't covered.

    I love it when things get difficult; after all, difficult pays the mortgage. - Dr. Keith Whites
    I hate it when things get difficult, so I'll just sell my house and rent cheap instead. - perldigious

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1174784]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 03:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found