On Fri, Jul 11, 2003 at 11:53:55PM -0700 Rus Foster wrote:
> I know what I'm about to ask is a really stupid question but I just can't
> get my head around my first outing with CGI.pm. I've RTFM as appropiate
> but getting nowhere. All I want to do is dump a list of variable and their
> values which have been parsed to a script. So far I have
Rob already commented on the mix between functional and object-oriented
interface. Just stick to one of them.
> #!/usr/bin/perl
>
> use CGI qw(:all);
> $query = new CGI;
>
> @names = $query->param;
>
>
> print header(), start_html();
> foreach $entry (@names)
> {
> print em(param('$entry'))."<br> \n";
Why do you use single quotes here? You want to pass the value of $entry
to param() and not the literal string '$entry':
print em( param($entry) ), br, "\n";
> }
>
> which I thought would work
>
> If I put print "$entry \n"; that prints out the variables but not the
> values. I know its going to be something stupid..What is it?
param() works a little like a hash: Calling it in list context is like
keys() on a hash (you did that alright). 'param($key)' is then very much
the same as '$hash{$key}'.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]