Welcome to the Monastery PerlMonks

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

by Not_a_Number (Prior)
 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 (==)

Replies are listed 'Best First'.
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.

Create A New User
Node Status?
node history
Node Type: note [id://1074165]
help
Chatterbox?
 [marto]: nice [choroba]: New blogpost after a long pause! marto needs to think of a joke where the punchline is "why the long paws?"

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2018-03-20 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (254 votes). Check out past polls.

Notices?