Basically I have written two perl modules that print a report presenting urls and the number of hits per url. The first is a text based format, the second prints html. As i used td tags in the html version i did not need to create fields for the url strings, which is when i ran into this problem. As the @ in the url string is treated as text when an eval is done it expects input. Here is a cut down version:
#!/usr/bin/perl %hash = qw(site.com 10 jamie@site.com:site1.com 4 user@hots:foo.bar 20 +); eval print_url_info(\%hash,10,"STDOUT"); write; exit 0; sub print_url_info { my ($url_data, $num_urls, $fh)=@_; my ($format)="", ($header)="$num_urls Most Popular URLs :", ($local_debug)=$debug, ($index)=0; ############## # Geneate a string to be eval'd containing the most popular x urls + for this user $format = "format $fh =\n"; $format = $format . "<!--- Start User Top URLS Section -->\n"; $format = $format . "<font size=3><u>$header</u></font><br><br>\n" +; $format = $format . "<table border=0>\n <tr>\n"; $format = $format . " <th align=left>URL</th>\n"; $format = $format . " <th width=10></th>\n"; $format = $format . " <th align=left>Num of Hits</th>\n +</tr>\n"; ############## # Print the urls in descending order $index=0; foreach (reverse sort { ${$url_data}{$a} <=> ${$url_data}{$b} } keys %{$url_data} ) { $format = $format . " <tr>\n"; $format = $format . " <td align=left>$_</td>\n"; $format = $format . " <td align=right> ${$url_data}{$_} + </td>\n </tr>\n"; ( ++$index == $num_urls ) && last; } $format = $format . "</table>\n<br>\n"; $format = $format . "<!--- End User Top URLS Section -->\n"; $format = $format . "\n.\n"; return $format; }
I am now using place holders to print the URLs which is ultimately preferrable however I would still like to find out if an @ or a ^ can be treated and printed as normal text in a format.

In reply to Re: Escaping an @ or a ^ in a format by jamieamieamily
in thread Escaping an @ or a ^ in a format 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.