How do I split ONE array to two separate arrays based on magnitude size and a threshold?
Posted
by
youhaveaBigego
on Stack Overflow
See other posts from Stack Overflow
or by youhaveaBigego
Published on 2012-09-19T21:35:32Z
Indexed on
2012/09/19
21:37 UTC
Read the original article
Hit count: 151
perl
I have an array which has BIG numbers and small numbers in it. I got it from after running a log from WireShark. It is the total number of Bytes of TCP traffic. But Wireshark does not discriminate(it would actually try, and hence it will tell you the traffic stats of ALL types of traffic, but since
This is how the Array look like :
@Array=qw(10912980
10924534
10913356
10910304
10920426
10900658
10911266
10912088
10928972
10914718
10920770
10897774
10934258
10882186
10874126
8531
8217
3876
8147
8019
68157
3432
3350
3338
3280
3280
7845
7869
3072
3002
2828
8397
1328
1280
1240
1194
1193
1192
1194
6440
1148
1218
4236
1161
1100
1102
1148
1172
6305
1010
5437
3534
4623
4669
3617
4234
959
1121
1121
1075
3122
3076
1020
3030
628
2938
2938
1611
1611
1541
1541
1541
1541
1541
1541
1541
1541
1541
1541
1541
1541
583
370
178)
When you look at these this array carefully, one thing is obvious to the human eye. There are really BIG numbers and small numbers. (Basically what I am saying is, there is the 1% class and low income class, no middle class). I want to split the array to two different arrays. That would require me to set a threshold. Array 1 should be ONLY the BIG numbers (10924534-10874126), and array 2 should be the smaller numbers (68157-178). Btw, the array is not sorted. User will NOT input the threshold, and hence should be determined smartly.
© Stack Overflow or respective owner