Changes to &parse_exhibitor

The next changes in the program, at least in terms of the sequence in which commands are actually executed, are down toward the bottom, in the &parse_exhibitor subroutine. The opening comment for that routine has been updated to reflect the additional scriptwide variables the routine will now be updating:

    # extract the relevant information about a particular
    # exhibitor and store it in the appropriate hashes.
    # 
    # invoked with an array of lines read from $exhibit_file.
    # has no return value, but instead modifies the following 
    # scriptwide variables:
    #
    # %listing
    # %index_line
    # %companies_by_letter

Toward the end of the subroutine, where it is adding the current exhibitor’s listing to the %listing hash, it now includes HTML markup:

    # create the %listing entry

    $listing{$co_name}  = <<"EOF";
<H2>$co_name</H2>
<P><STRONG>Booth $booth</STRONG></P>
EOF

Also, as subsequent parts of that listing are added to $listing{$co_name}, the subroutine uses if statements to avoid adding an element if that particular element isn’t present for this particular company. Notice, though, how we’re using a one-line version of the if test that you haven’t seen before:

 $listing{$co_name} .= "<P><EM>"; $listing{$co_name} .= $address if $address; $listing{$co_name} .= "<BR>\n$address2" if $address2; $listing{$co_name} .= "<BR>\n$phone" if $phone; $listing{$co_name} .= "<BR>\n$fax (fax)" if $fax; $listing{$co_name} .= "<BR>\nEmail: <A HREF=\"mailto:$email\">$email</A>" if $email; ...

Get Perl for Web Site Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.