CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Calling Subroutines



Aug 29, 2000, 11:36 PM

Post #1 of 2 (496 views)
Calling Subroutines Can't Post

Good Morning all,

I wonder if anyone out there could help? I've created a script that prints an html form, then when I want to parse the form I call a subroutine, but it just doesn't appear to work.

I've added some very simple code here to display what I've got, is it difficult or am I missing something simple?

Here's the code, and you can see it in action here.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


# Call subroutine print_html

# Specifies the subroutine print_html
sub print_html{
print "Content-type: text/html\n\n";
print qq{
<title>Test Form Script</title>
<body bgcolor="#000000" text="#FFFFFF">
<form method="post" action="?get_info">
Select an option<br>
<input type="radio" name="select" value="Yes">
<input type="radio" name="select" value="No"><br>
<input type="Submit" name="Submit" value="Submit">

# Specifies the subroutine get_info
sub get_info{
use CGI;

# Specifies the subroutine check_it
sub check_it{
print "Content-type: text/html\n\n";
print "You selected $results";

Regards and TIA
Richard Smile

Dizzie Scripts


Aug 31, 2000, 9:58 PM

Post #2 of 2 (496 views)
Re: Calling Subroutines [In reply to] Can't Post

I think that your sub{ is getting confused with the { in print qq{

so instead of

print qq{

print qq~

Also I noticed that you left out the ; after the } wich is part of the print qq{}

You need to end the qq{} with a ; always. I think That may contibute to the confusion between the sub's } and the print qq's }.

But Try the

print qq~

Anyway and stay away from print qq{}



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives