I would like to have an if/else statement to print the word "Email" when displaying records that contain a valid email address, but I can't get code below to work.
Any suggestions?
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';
print qq|
<font face="arial" color="white">
<br><b>$rec{'Name'}, </b>$rec{'Title'}<br>
$rec{'Company'}<br>
$rec{'Address'}<br>
$rec{'City'}, $rec{'State'} $rec{'Zip'}<br>|;
if ( $rec{'Email'} eq '.+@.+\..+' )
{
print qq~ Email: $rec{'Email'}<br> ~;
}
else
{ print qq| <br>|;
}
;
Any suggestions?
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';
print qq|
<font face="arial" color="white">
<br><b>$rec{'Name'}, </b>$rec{'Title'}<br>
$rec{'Company'}<br>
$rec{'Address'}<br>
$rec{'City'}, $rec{'State'} $rec{'Zip'}<br>|;
if ( $rec{'Email'} eq '.+@.+\..+' )
{
print qq~ Email: $rec{'Email'}<br> ~;
}
else
{ print qq| <br>|;
}
;