APM: Hashes and grep

Tom Bakken tom.bakken at tx.usda.gov
Mon Mar 17 12:07:20 CST 2003


I've been using CGI.pm for some time as well as Lincoln Stein's "Official
Guide to programming CGI.pm".  I'm trying to modify his Multi-Part Form
program to use with a database and custom input screens.  Because some of
the fields can't be text boxes like the examples, I've had to change his
code.

The problem is my ignorance of how some of the code he uses works.  The book
doesn't explain code like the following:

Foreach (values %FIELDS) {
  Grep($ALL_FIELDS{$_}++,@$_);
}

And:

grep ($fields{$_}++, @fields);
(@hidden_fields = grep(!$fields{$_}, keys %ALL_FIELDS);

I'm getting error messages I can't resolve:
Not an ARRAY reference at (eval 38) line 12, <H\:\\Forms\\T\&A\.fml> chunk
1464

Any of you familiar with this code that can give me a clue?

Tom Bakken




More information about the Austin mailing list