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";
In reply to Re: How do I link in CGI?
by monkeygirl
in thread How do I link in CGI?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |