Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
  • %~ is not available for your use. Punctuation variables are reserved for perl's use. The ^_ namespace is reserved for this use. The closest available analogue of %~ is %{'^_~'} because %^_~ is a syntax error. I'd suggest %^_C to follow the \C{name} theme.

  • Hashes are cleared by assigning an empty list, not by undefining them. When you say %hash = () you allow perl to be smart about the allocation of the memory associated with %hash. undef %hash circumvents this and forces some unnecessary work.

  • I deliberately placed the new syntax to the right of the capture because otherwise I would have had to do some balanced delimiter matching. perlop covers the requirements for matching (...) in regexps. It is possible, I just couldn't do it in the two minutes it took to write the initial example.

    The implication of allowing $~{EXPR} to inform the creation of the hash key is that you must allow arbitrary perl code inside EXPR. This is not a problem if you take into account the same balanced-tag handling already mentioned in perlop.

    To do this really well requires Text::Balanced and an understanding of Gory details of parsing quoted constructs from perlop.


In reply to Re^4: RFC: named pattern match tokens by diotalevi
in thread RFC: named pattern match tokens by revdiablo

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found