Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: Need to sort and data structure based on values inside arrayrefs.

by Laurent_R (Canon)
on Apr 01, 2014 at 21:42 UTC ( [id://1080643]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Need to sort and data structure based on values inside arrayrefs.
in thread Need to sort and data structure based on values inside arrayrefs.

Yes, I fully agree with you, and it is a pretty clever way ++. I probably would not have thought about simply silencing out undef warnings and still get a rather consistent output, but would have probably gone through a more complicated conditional expression to check for "definedness" (if that word exists) of both variables before comparing them and return the right positive, negative or null value depending on the case..

But, in the case in point, I just wanted to give a different example showing how to do the task in broad terms, and let the OP give more precise specifications on the edge cases (especially given that there are other edge cases, such as empty strings, etc.). I am working almost daily with incomplete specifications, and can usually work my way around that because I have also a good functional knowledge on most of the applications on which I am working, but that is also getting sometimes on my nerves, because there are cases where I just do not know well enough the functional context. So, when I don't know the context well enough, as in the case we are talking about in this thread, I am often preferring to just play it a bit stupid and say: "Tell me exactly what you want it to do, and I'll try to do it for you. But don't expect me to take the decisions for you just because you are unsure of what they should be, because I don't want you to then reject these decisions and tell me it is a development bug when you figure out later that you really needed something else than what you specified. Take your responsibilities, and I'll take mines." Not that I have any hostility against people making the specifications, I have also been doing that job for years, I know it is not always easy. And, often enough, a phone call or a mail exchange can clarify the issue.

Well, I am getting somewhat off-topic here, sorry about that. To summarize, I'll be happy to provide another version of my proposed solution if the OP gives precise information on how this should work for edge cases. If not, then, at least, I think you and I have provided good examples on how to do it, they can be adapted to real needs.

  • Comment on Re^5: Need to sort and data structure based on values inside arrayrefs.

Replies are listed 'Best First'.
Re^6: Need to sort and data structure based on values inside arrayrefs.
by AnomalousMonk (Archbishop) on Apr 02, 2014 at 17:19 UTC
    I am working almost daily with incomplete specifications, and can usually work my way around that ..., but that is also getting sometimes on my nerves, because there are cases where I just do not know well enough the functional context. So, when I don't know the context well enough, ... I am often preferring to ... say: "Tell me exactly what you want it to do, and I'll try to do it for you. But don't expect me to take the decisions for you ..., because I don't want you to then reject these decisions and tell me it is a development bug ...

    Yea and amen, brother! And in addition to people who expect you to guess what they want and then take responsibility upon yourself when you guess wrong, there are those who consider each scrap of specification information to be a state secret even though you're both employed by the same company and may even be working in the same department.

Log In?
Username:
Password:

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

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

    No recent polls found