gopikavi has asked for the wisdom of the Perl Monks concerning the following question:

Here i tried to create table and column two values from perl variables and increase the serial number automatically.But i confused with how to pass perl variables into html tags using perl cgi
code/;
#!/usr/local/bin/perl use CGI; print "Content-type: text/html\n\n"; print <<"EOF"; <HTML> <HEAD> <TITLE>Sub Version!</TITLE> </HEAD> <BODY> <H1><center>version</center></H1> <center> <table border="2"> <th>serial no</th><th>name</th><th>anagement</th> <tr> <td>1</td> <td>$str</td> <td>g</td> </tr> </table></center></BODY> </HTML> EOF open(file,"csk.access"); @name=grep { $_ =~ m/^\[/} <file>; s/\W//g for @name; $str=join '',@name; print $str,"\n"; close file;

Replies are listed 'Best First'.
Re: How to pass my variables into html part using perl cgi?
by marto (Cardinal) on May 09, 2017 at 09:11 UTC

    You need to stop now, and review the advice you've already been given several times. perlintro, and also the CGI documentation. Take the time to read and understand this. You must be copying and pasting your code, you don't do things in a consistent manner (for example your use of open) between scripts. Stop posting rapid fire questions and spend some time learning to use the tool you've chosen. http://learn.perl.org.

Re: How to pass my variables into html part using perl cgi?
by Corion (Patriarch) on May 09, 2017 at 09:04 UTC

    You are using the variable $str before assigning a value to it.

    Perl will warn you about this if you allow it to. See warnings on how to enable that.

    Perl can also enforce that you need to declare your variables before using them. See strict on how to enable that.

    Both practices help Perl help you better by pointing out very likely errors.

Re: How to pass my variables into html part using perl cgi?
by hippo (Archbishop) on May 09, 2017 at 09:25 UTC
      you know what happens when you assume two things are the same when they aren't?