You may want to check out a smiliar thread, which would have pointed you at import_names() method mentioned amongst other things, but there are more tricks you may want to try ...

... @{[ ]}-voodoo to embed arbritrary expressions inside strings.

print REG qq[; Last Name : @{[ param('Last_Name') ]} First Name : @{[ param('First_Name') ]} ]

... use printf() to move the param()'s outside your string.

printf REG qq[Last Name : %s\nFirst Name : %s\n], param('Last_Name'), param('First_Name'); ## ... or ... printf REG <<__TEXT__, param('Last_Name'), param('First_Name'); Last Name : %s First Name : %s __TEXT__

... resort to the much underused (?) formats if you like to see a little more clearly what goes where.

format REG = Last Name : @<<<<<<<<<<<<<<<<<<<<<<<< param('Last_Name') First Name : @<<<<<<<<<<<<<<<<<<<<<<<< param('First_Name') . write REG;

The downside to these are you need to be mindful of what param() is returning as a multi-value param() could throw things out of whack if you're only expecting a single value, something import_names() neatly sidesteps by providing both scalars and arrays of the same param() to make context explicit.

    --k.



In reply to Re: Re: Re: Changing a variable name by Kanji
in thread Changing a variable name by Anonymous Monk

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.