Okay, I'll confess I'm no whiz at using bit vectors in perl, but I still find your question confusing, and I think you need to provide more information (or be more careful about what you're trying to say). In your example, it looks like the output of the sort is shorter than the input, but the truncation is inconsistent: the input has a couple of "3"s, where the output has one "3"; the input has four "5"s, where the output has three of them.
How many bits make up each element of the bit vector string?
If your real goal is to sort the integer values in one big file based on the integer values in some other big file, there are probably better ways to do this than trying to cram all that data into memory as bit vectors. But I wouldn't hazard a guess about that, since I still don't quite get what you're after.
(For that matter, if you have already solved the problem by other means, and are just fishing for some different way to do it, that still strikes me as being more like homework, even if you aren't doing it for a grade.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.