A few years ago I saw a code that converted everything to 1s and 0s and it was easy to encode and decode from that but I can't find it.

Bit-wise not (~) applied to a string does exactly that very efficiently:

$s = 'The quick brown fox jumps over the lazy dog';; print unpack 'C*', $s;; 84 104 101 32 113 117 105 99 107 32 98 114 111 119 110 32 102 111 120 +32 106 117 109 112 115 32 111 118 101 114 32 116 104 101 32 108 97 12 +2 121 32 100 111 103 $t = ~$s;; print unpack 'C*', $t;; 171 151 154 223 142 138 150 156 148 223 157 141 144 136 145 223 153 14 +4 135 223 149 138 146 143 140 223 144 137 154 141 223 139 151 154 223 + 147 158 133 134 223 155 144 152 $u = ~$t;; print unpack 'C*', $u;; 84 104 101 32 113 117 105 99 107 32 98 114 111 119 110 32 102 111 120 +32 106 117 109 112 115 32 111 118 101 114 32 116 104 101 32 108 97 12 +2 121 32 100 111 103 print $u;; The quick brown fox jumps over the lazy dog

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Simple perl encoder by BrowserUk
in thread Simple perl encoder by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.