Let's Add Some Spice
Aaron Jensen
atjensen at home.com
Tue Jun 6 11:37:24 CDT 2000
It's time to spice up the mailing list.
I have a question about some code I've encountered in
Lincoln Stein's "Official Guide to Programming with CGI.pm"
page 71. (Don't worry, my question isn't about CGI.)
Here is the code:
0 #! /usr/bin/perl
1
2 # script: loan.cgi
3 use CGI qw/:standard :html3/;
4
5 # this defines the contents of the fill out forms
6 # on each page
7 @Pages = ('Personal Information','References',
8 'Assets','Review','Confirmation');
9 %FIELDS = (
10 'Personal Information'=>
11 ['Name','Address','Telephone','Fax],
12 'References'=>
13 ['Personal References 1','Personal References 2'],
14 'Assets'=>
15 ['Savings Account','Home','Car']
16 );
17
18 # accumlate the field names into %ALL_FIELDS:
19 foreach(values %FIELDS){
20 grep(%ALL_FIELDS{$_}++, @$_);
21 }
My question is, what is happening on lines 19 - 21? I've
stared at it and stared at it, looked in Perl books,
experimented, and have a very fuzzy approximation/guess of
what is going on. I know what the result is, just not how
that result is acheived. How can clear things up for me?
--
=-=-=-=-=-=-=-=-=-=-=-=
Aaron Jensen
atjensen at home.com
Visual Prose Web Design
www.proseweb.com
=-=-=-=-=-=-=-=-=-=-=-=
TIMTOWTDI
More information about the Pdx-pm-list
mailing list