On Sep 27, 2007, at 6:41 PM, Michael Barto wrote:

Perl snippet question:

---------------------------------------------
#!/usr/bin/perl -w

use strict;
use CGI;
use CGI::Carp 'fatalsToBrowser';


my $new_page = new CGI("");
sub HTMLendFORM ($) {
    my $new_page = $_[0];
    print $new_page->end_form;
}


HTMLendFORM ($new_page);

print "\n\n";
---------------------------------------------

This above code produces "<div></div></form>". This ti me is odd, since i only really want </form>. Does anyone have an explanation or another way to use the CGI.pm library and produce only </form>. Yes I could just use a print statement. But I am kind of curious to why?


Why are you doing it this way? You do not need a sub and it is best to use $q (or the functional interface) since if anyone has to read your code they will recognize $q immediately but wonder what $new_page is for. And why are you printing two new lines? New lines do not show up in HTML.

Try this:

print $q->end_form();

That usually produces </form>

Reply via email to