Yes, you show no code, the problem description is very vague, you don't say with what the words are to be 'replaced', and yes, this does smell like homework, but...

c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'In the table above, the characters themselves, in the first +column, are links to descriptions of characters'; print qq{'$s'}; ;; my %xlate = qw(table tooble characters croobles selves others first second +links loonks); ;; my ($word) = map qr{ $_ }xms, join q{ | }, keys %xlate ; print $word; ;; $s =~ s{ ($word) }{$xlate{$1}}xmsg; print qq{'$s'}; " 'In the table above, the characters themselves, in the first column, a +re links to descriptions of characters' (?msx-i: first | selves | table | links | characters ) 'In the tooble above, the croobles themothers, in the second column, a +re loonks to descriptions of croobles'

Update: Caution: long lines: some wraparound may have occurred.


Give a man a fish:  <%-(-(-(-<


In reply to Re: Regular Expressions by AnomalousMonk
in thread Regular Expressions by replytokp

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.