There's two different ways to do it. First, the better way (CGI.pm)

# This line loads the CGI.pm module. use CGI; # Print any error messages to the browser use CGI::Carp qw(fatalsToBrowser warningsToBrowser); my $im_better = new CGI; # You need to print a content header so you don't end up with Server 5 +00 errors print $im_better->header(); print $im_better->start_html(-title => 'Test Page'); # The coveted link print $im_better->a({href=>"http://www.google.com"}, 'Google'); $im_better->end_html();

Or you can do it quick and dirty:

print "Content-type: text/html\n\n"; # The content header ..... # Put stuff you need here print '<a href="http://www.google.com>Google</a>';

If you're also processing form results, etc., I strongly urge you to use CGI.pm.

Update: Your reply to E-Bitch leads me to believe you might be talking about redirection. In which case:

use CGI; my $im_better = new CGI; # Please note that I didn't print a header this time print $im_better->redirect("http://www.google.com");

And the quick and dirty way:

# I also didn't print a header this time either print "location:http://www.google.com\n\n";

Sarah
If Bill Gates can name a company after his "bedroom" problems, I can have a stupid sig that points it out.

In reply to Re: How do I link in CGI? by monkeygirl
in thread How do I link in CGI? 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.