Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Adding only searched values to array ref

by AnomalousMonk (Archbishop)
on Sep 22, 2021 at 11:03 UTC ( [id://11136952]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Adding only searched values to array ref
in thread Adding only searched values to array ref

++Marshall for the post, but

  • since an 'acc' value like '239876A' seems possible (per the OPed example), a string comparison should be used; and
  • the OPed example wants records added to the output array if a particular key does not have a certain value, so ne should be used, e.g.,
        push @$all, $href if $href->{acc} ne '44443';
    (untested).


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^5: Adding only searched values to array ref
by Marshall (Canon) on Sep 22, 2021 at 22:06 UTC
    Thank you for pointing that out!++ I have updated my post. Your suggestion is exactly correct and I show actual run results.

    Sorry for the goof! This issue just highlights the importance of showing "desired output" in the Original Post. If such a thing had existed, I would have detected this error myself.

    I did see this alpha-numeric account number. And thought about things such as how to sort the @$all by account number. And now I see also either preventing or removing duplicate records for @$all might be necessary? However the OP is not asking about that at this time. Let's see what develops along that front, if anything.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-04-24 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found