[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Perl and web pages

I would like to make a web page with perl.
In this page I want to include a table with results.
So First I want to create the procedures
I create a file.pl wich includes 3 generic procedures.

sub Create_table
sub Create_line
sub Close_table

example
Create_table(2,50)

$NL="<P>\n";

sub create_table {
    local($border,$ancho)=@_;
    print "<table border=\"$border\"  width=\"$ancho%\"> ";    
print "$NL";
}

Create_line(50,Hello)

sub create_line {
    local($ancho,$texto)=@_;
    print "<tr>\n";
    print "<td width=\"$ancho\%">$texto</td>\n";
    print "</tr>\n";
}

sub close_table {
    print "</table>";
print "$NL";
}

This Sub doen't works because of the " character, can antybody tell me how to correct this code.
0
Pampa
Asked:
Pampa
1 Solution
 
spiegeiCommented:
Just a couple suggestions.

Make sure that you are calling the subs in the same case. I think this could prevent it from being recognized.

so if the sub is sub create_line

call it with create_line() not Create_line()

Perhaps make sure to call the function after it is defined.

Try
                sub create_line {
                    local($ancho,$texto)=@_;
                    print "<tr>\n";
                    print "<td width=\"$ancho\%">$texto</td>\n";
                    print "</tr>\n";
                }

create_line(50,Hello)

Good Luck.
0
 
ozoCommented:
create_line(50,"Hello");
sub create_line {
    local($ancho,$texto)=@_;
    print "<tr>\n";
    print "<td width=\"$ancho%\">$texto</td>\n";
}
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now