in reply to Re: How do I reverse the order of the first and last word of a string?
in thread How do I reverse the order of the first and last word of a string?

And thse people will wonder where suddenly the null bytes are coming from. There'll be exactly as many as the difference in length between the first and the last word, because the shortest word will be padded with "\0" to the length of the longest one.
  • Comment on Re^2: How do I reverse the order of the first and last word of a string?

Replies are listed 'Best First'.
Re^3: How do I reverse the order of the first and last word of a string?
by GrandFather (Saint) on Mar 11, 2007 at 19:51 UTC

    Actually the void context map that gives blazar goose bumps below fixes that problem. As blazar suggests, a translate (y/\0//d for @words;) would be cleaner however.


    DWIM is Perl's answer to Gödel