Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Adding only searched values to array ref

by Marshall (Canon)
on Sep 22, 2021 at 09:07 UTC ( [id://11136945]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
     use strict;
    use warnings;
    ...
    Before suggesting code for that, I'd like to hear from the
    OP whether this can really happen in "the real world" and
    if such a solution is even needed.
    
  2. or download this
    # make the @$all array the union of everything in
    # either @$all or @$accounts, excluding the acc 44443 record
    ...
    
    my %seen;
    @$all = grep{ $_->{acc} ne '44443' and !$seen{$_->{acc}}++ } @$all,@$a
    +ccounts;
    
  3. or download this
    use strict;
    use warnings;
    ...
      { acc => 54321, date => "1999-06-19", year => 2017 },
      { acc => 44443, date => "1980-03-05", year => 2019 },
    ]
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2024-04-25 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found