Perl 5.004, huh? I think your problem is related to your perl version. So it can be that ${link} will always give a problem with a perl this old. Note that link is a built-in function.

To get around your problem, I'd suggest using sprintf or printf. In particular, the first line, with the sub call, will look a lot cleaner:

my $link = sprintf '<a href="%s">', getQueryString('title'); printf "<th>%sTitle</a></th>\n", $link;
or something even more compacted.

p.s. you should really reconsider properly escaping these strings, for proper inclusion in HTML. The proper order is first URL-escaping, and next HTML-escaping the string. Perhaps you have already taken care of it, or part of it, in your sub, and I don't know what subs you have available for this purpose (it depends on the library you use), so I won't give the complete code.


In reply to Re: Printing Scalars Next to Text by bart
in thread Printing Scalars Next to Text by svsingh

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.