Fellow Monks
First of all, this is not homework. I have a real problem behind this and can send full source code of my (unpublished) TWiki's MessageBoardPlugin if you want to see it.

My problem is optimization. I'm sure that using @_ instead of copying functions args to scopped variables is faster, and need to use this here:

# inputBox( $url, $msgid, $action, \%data ) sub inputBox{ my $data = $_[3]; # some code here... # some processing here... return $result . map this($_), # hash de-ref and slicing at the same time... # however, can't do this with $_[3], syntax error. @$data{'a','b','c','d'};

I would like to use $_[3] instead of $data, but I can't, it generates a syntax error.

So what I need is a way to slice a de-referenced hash in just one shot. Any sugestions?

Thank you very much for your help.


In reply to Trying to optimize de-referenced hash slice without scope variables... by monsieur_champs

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.