in reply to How to transpose lines faster?
I would have used with_substr() (in the spoiler), but your chop-based is faster during my test. However, if the character '0' (ASCII 48) is in your possible alphabet, chop() won't give the right answer
update: chop will fail because you're testing the truthiness of the character it returns. '0', like 0, is false.
update 2: hmm, no, you should be testing the truthiness of the whole string. When I had '0' in my alphabet, it dropped one or more '0's from the last row of @$wch... Oh, right, if the last character in one of the strings in @original ends in one or more zeroes, then it will evaluate to false, rather than your expected true. So if '0' might be in your alphabet, you should probably test the if length($_) instead.
update 3: I meant while length $_...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to transpose lines faster?
by pryrt (Abbot) on Feb 01, 2018 at 22:23 UTC | |
by rsFalse (Chaplain) on Feb 02, 2018 at 12:00 UTC |