For the life of me, I can't figure out what you meant to write. I presume that is because you formatted what you wrote nicely in your window, but did not include the tags that make paragraphs and separate code from text. So all of it became one long line.
You can try and re-edit your question using the tags to make your question more readable (See Writeup Formatting Tips). Trying to guess what you may have intended, I believe that perhaps there were two columns, something like:
I would like to perform a match on array value at position 0 i.e.: $array[$i[0]] and if the match found find a difference between values in corresponding position 1.order_id, time_mins 096000BN, 32 096000BP, 85 096000BG, 132 096000Be, 85 096000BP, 32 & etc.... ...
I guess that you mean: where there are matches in column 1, you want to see the time difference. Yes hashes would be the way to go here. In each hash position, keep an array of times. For example if we had this data in a file, we could read the file and do:
This will get you started. You can then do the differences as you like. If you want to know the position of the matches, you need to do some extra.my %hash; while (<>) { my ($id,$time) = split /,/; push @{$hash{$id}}, $time; } for (keys %hash) { print "@{$hash{$id}}\n"; }
In reply to Re: Comparing elements of array...
by b4swine
in thread Comparing elements of array...
by angelfish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |