or.. (shorter than Eily's one ;)

perl -pe 's|\d|(a..z)[$&-time%7]|eg' input.txt
That's nearly always correct (if you ignore the fact that it's a shift, not a shuffle). You'll get different values if the lines are not treated in the same second. This would happen if the first line is handled at 9:59:59.9999 and the second at 10:00:00.0000 (add the proper number of digits). Or if you are working on a piped input from a slow program, or the input is big enough. This can be demonstrated by adding a sleep.

I realized I could shorten the other version (I don't feel like calling it mine when I just took your idea and rewrote it :P), but it's still longer than your latest proposition:

perl -pe '@h{a..z}=1;s/\d/(%h)[$&*2]/eg' input.txt

Because since this is golfing, why would you bother doing things properly/efficiently? :P


In reply to Re^2: A little golfing challenge: replace digits by random letters (updated) -- oneliner by Eily
in thread A little golfing challenge: replace digits by random letters by haukex

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.