in reply to Re: Reading form data and printing variables using CGI.pm
in thread Reading form data and printing variables using CGI.pm

But how does the variable become associated to the HTML line? 'is the value of $Firstname', Thanks
<code> #!/usr/local/bin/perl -w use strict; use diagnostics; use CGI qw(:standard); my $Firstname = param('Firstname'); print header(), start_html(-title=>"CGI.pm Example Script"), h1('Hello World!'), 'is the value of $Firstname', end_html(); exit (0);

Replies are listed 'Best First'.
Re: Re: Re: Reading form data and printing variables using CGI.pm
by gryphon (Abbot) on Jul 19, 2002 at 22:33 UTC

    Greetings cal,

    In Perl, using a single quote simply reads a string literally, but a double quote interprets a string. In your code, you have single quotes around the string where you use $Firstname. So what gets printed is literally "$Firstname". You actually want Perl to interpret the variable, so...

    print header(), start_html( -title => 'CGI.pm Example Script'), h1('Hello World!'), "is the value of $Firstname", end_html();

    -gryphon
    code('Perl') || die;

Re: Re: Re: Reading form data and printing variables using CGI.pm
by PodMaster (Abbot) on Jul 19, 2002 at 21:48 UTC
    Huh?
    my $PERL_FAQ = "butterscoth"; print 'my $PERL_FAQ \n'; print "my $PERL_FAQ \n";

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.