ok guys,
thanks for the help ... in fact, i was quite sure, that my query was
not as vague as some of you appear to have understood it.
I am quite sure that it was as vague as some of us understood it.
i am also
aware, that it's not really helpful to criticize the people you're
asking for help, anyway i'd like you to reconsider discussing some ot
about posting guidelines (which i have read --- before i posted my
first msg) in this thread ...
If you read them, then why didn't you follow them?
Paul Lalli got it all right, i want to basically binary-add up
fixed-length ascii-strings which contain '0' and '1', character-wise
(10 + 11 = 10).
What you want is not "add"ing up, that is "and"ing up. And 10+11 does not
give 10, at least not in Perl. See, we want you to post Perl, not some
psuedo language and not only some vague English, to avoid exactly these
problems.
Anyway, my need has changed a bit (in fact the adding technique didn't
work ... *dough*). I need to have a 1 in the output string, if _the
majority of remaining strings_ (more than half) has a 1 there. My
attempt is to simply iterate through the indices $i of the strings and
then add up (arithmetically) all $i'th characters in all strings. If
they amount to more than half of the number of strings, i'll write a 1.
I didn't implement it yet (not working right now).
I'd just split the strings into arrays and work with them that way.
my @x = split //, $string;
Just to clarify: I am indeed capable of writing such trivial snippets
myself.
Then why didn't you?
Yet in my (very recent) experience with perl i have learned,
that there are A LOT of very neat and short ways of doing such things.
If you give us short, runnable code that does what you want, we can help
you turn it into code that is neater, faster, and/or even shorter. If you
give us vague English desciptions of what you want, we are much less likely
to be able to do that.
Additionally If your project is supposed to scale properly you also
need to consider the speed of your implementation of such frequently
used code-snippets ... I think it's fun to think of such snippets which
are small, fast and do a lot, that's why I posted ...
If you include the slow snippet, we will know exactly what you want done,
we will know that you actually put some effort into it, we will be able to
test our proposed code to make sure it does the same thing as your slow
snippet, and we won't waste our time making something which is essentially
identical to what you already have.
Xho