Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Argument "" Isn't numeric in numeric eq (==)

by Not_a_Number (Parson)
on Feb 09, 2014 at 21:27 UTC ( #1074165=note: print w/ replies, xml ) Need Help??


in reply to Argument "" Isn't numeric in numeric eq (==)

I am trying to get the count of lines with successful cases (1,1) and lines with failed cases (1,2).

Not enough information:

  • Is 112 a success or a fail (and why)?
  • Do the tuples (1,1) and (1,2) have to be contiguous (is 13167 a success or a fail)?
  • Does order matter (is 2115 a success or a fail)?


Comment on Re: Argument "" Isn't numeric in numeric eq (==)
Re^2: Argument "" Isn't numeric in numeric eq (==)
by Kenosis (Priest) on Feb 09, 2014 at 22:02 UTC

    The OP's code answers these questions.

    Given the OP's dataset:

    1,1,,,, 1,2,,,, 3,4,1,1,, 1,1,1,1,, 5,6,3,4,1,2 1,1,,,, 1,1,1,1,1,1

    the code indicates that "Success" obtains when at least one of the following tuples is '1,1' and "Fail" obtains when one is '1,2':

    (n,n),(n,n),(n,n) ^ ^ ^ | | | | | + - Tuple 3 | + - Tuple 2 + - Tuple 1

    Edit: Added the "Fail" condition. Thank you, Jim.

      Read the OP again. There's both a "success case" (1,1) and a "fail case" (1,2), and they're independent. There's nothing in the specification of the problem that precludes the possibility of both a success case and a fail case in the same three-tuple record. As it happens, there isn't an example in the OP of a record that has both a success case and a fail case in it. So the record ,,,,, has neither a success case nor a fail case in it, and the record 1,1,1,2,1,2 has one success case and two fail cases in it. However, the specification is to count the number of records that have success cases and fail cases in them, not the number of such cases.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-08-28 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (255 votes), past polls