[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: what is perl 's syntax or grammer?(toward e-commerce)



On Fri, Dec 13, 2002 at 01:02:10PM -0500, David Z Maze wrote:
> > foreach my $name (param()) {
> >    my @value = param($name);
> 
> Are you sure you don't mean $value here?

Not necessarily.  param() returns the first value associated with the
name whan called in scalar context or a list of all values associated
with the name in list context.

> >    print "<p>The field with the NAME attriabute equal to <b>
> >    $name</b> had a VALUE equal to <b>@value</b></p>\n";
> 
> ...and here?  I'd probably change this loop to something like
> 
>   foreach my $name (@param) {
>     print "$name: " . param($name) . "\n";
>   }

foreach my $name (@param) {
  print "$name: " . join ', ', param($name) . "\n";
}

-- 
The freedoms that we enjoy presently are the most important victories of the
White Hats over the past several millennia, and it is vitally important that
we don't give them up now, only because we are frightened.
  - Eolake Stobblehouse (http://stobblehouse.com/text/battle.html)



Reply to: