Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Think about Loose Coupling
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
The no warnings qw/syntax/; line seems unnecessary. Is there a reason for it?
For this program, that line doesn't serve any purpose. But then, neither do the two lines above - yet you aren't inquiring about them. The first six lines are generated whenever I type ^A-P (two chars), and I don't bother to remove the last line if it happens to occur in a program where it's unnecessary.

Trying to answer my own question I did re-implement your solution with simple tied scalars, and found no functional difference,
The fact that the entire word is replaced with identical characters didn't strike you as a functional difference? In this specific case, you could get away with using tied scalars if you also used /e, but if letters had to be replaced with a random letter enclosed in parenthesis, using a tied has would lead to:
s/(\w)/($h{$1})/g;
while you would need something like:
s/(\w)/"($s)"/eg;
which, while it has less characters, is less obvious, IMO.

Abigail


In reply to Re: s/\w/random character/g by Abigail-II
in thread s/\w/random character/g by Plankton

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (4)
    As of 2014-04-19 19:18 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (483 votes), past polls