Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I did not ask you to define the hash/collection. I wanted you to show us how does the hashLookup() function look like. If you want a "complete" example so let's define a function that receives a template and a hash containing the values to insert into the template and returns the text with the values:

sub fillTemplate { my ($text, $hash) = @_; $text =~ s/%(\w)%/$hash->{$1}/g; return $text; }

How complex and twisted is the code in C#? Especialy considering the fact that the second parameter for Regex.Replace() is a delegate and that C# doesn't support unnames functions and closures? You have to define the hashLookup() as a fullblown method and you have to find a way to pass it the collection somewhere behind the scenes.

Either it can be a static method and then you'll have a static field in the class that'll hold the reference to the collection. Or you can create a brand new class that'll contain just the hashLookup() method and the reference to the collection. Or do I miss anything?

This is not the difference between Pascals begin-end and C's {}, there I would agree it's just an unimportant matter of verbosity. This is something so awkward, lengthy and unmaintainable that noone can be expected to use regexps. Except maybe for validations.

We'd like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home
   -- P. Simon in Mrs. Robinson

In reply to Re^6: Murder of a Perl coder (announced) by Jenda
in thread Murder of a Perl coder (announced) by Discipulus

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, 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
  • 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.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (5)
    As of 2021-01-24 19:29 GMT
    Find Nodes?
      Voting Booth?