kdelph has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl use CGI; use CGI qw/:standard :html3 :html4 :netscape :all/; use CGI::Carp 'fatalsToBrowser'; use CGI::Push qw/:standard/; use POSIX qw/strftime/; $query = new CGI; print $query->header; print $query->start_html('Digital Markets Deal Log'); print "<H1>Digital Markets Deal Log</H1>\n"; # Print the first form print $query->startform; $date =(`ls FxDe* | grep -v .gz`); ###################################################################### +############################################# # Variables ###################################################################### +############################################# # file locking (flock): 1=shared, 2=exclusive, 8=unlocked use vars qw/$Time $Dealid $Clientid $CurrencyPair $message $line $name + $date @rows/; my $file ="$date"; my $style; ###################################################################### +############################################# print "What is the Deal ID? ",$query->textfield('name',$name,25); print "<P>Select The Date? ", $query->popup_menu('date',["$date"]), "<P>"; print $query->submit('form_1','Get Deal Info'); print $query->endform; print "<HR>\n"; $query->import_names('Q'); if ($Q::form_1) { open(MESSAGE, "$file") || die "Couldn't open $file: $!\n"; my $locked = flock(MESSAGE,1); unless ($locked) { warn("Couldn't get lock for reading: $!"); alarm(0); close MESSAGE; return undef; } while ($line = <MESSAGE>) { chomp $line; ($Time, $Dealid, $Clientid, $CurrencyPair) = split(/\,/, $line); if $name =~ (/$Dealid/) { unshift(@rows, table({-bgcolor=>'454B74', -border=>'0', -cols=>'2'}, Tr( td({-width=>'25%'}, strong("Time: ") ), td($Time) + ), Tr( td({-width=>'25%'}, strong("Deal ID: ") ), td($Dealid +) ), Tr( td({-width=>'25%'}, strong("Client ID: ")), td($Client +id) ), Tr( td({-width=>'25%'}, strong("Currency Pair: ") ), td($C +urrencyPair)) ), # end table ); } # end if } } $style=<<END; <!-- body { scrollbar-face-color: 454B74; scrollbar-shadow-color: 8792BD; scrollbar-highlight-color: ECECEC; scrollbar-3dlight-color: 000000; scrollbar-darkshadow-color: 000000; scrollbar-track-color: 8792BD; scrollbar-arrow-color: FFFFFF; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12 +px; color: 999999; } td { font-family: tahoma, arial, helvetica, sans-serif; font-size: 12 +px; color: 8792BD; } .td2 { font-family: tahoma, arial, helvetica, sans-serif; font-size +: 13px; color: ececec; } .text { font-family: tahoma, arial, helvetica, sans-serif; font-size +: 10px; color: 8792BD; } .mash { font-family: tahoma, arial, helvetica, sans-serif; font-size +: 13px; color: 8792BD; font-weight: bold; } .mash2 { font-family: tahoma, arial, helvetica, sans-serif; font-size +: 15px; color: 8792BD; font-weight: bold; } a:link { font-family: tahoma, arial, helvetica, sans-serif; font-size +: 11px; color: ececec; } a:visited { font-family: tahoma, arial, helvetica, sans-serif; font-si +ze: 11px; color: ffffff; } a:active { font-family: tahoma, arial, helvetica, sans-serif; font-si +ze: 11px; color: 999999; } a:hover { font-family: tahoma, arial, helvetica, sans-serif; font-size +: 13px; color: 999999; } --> END print header(); print start_html(-title=>'', -bgcolor=>'454B74', -style=>{-code=>$styl +e}), div({-align=>'center'}, # this table displays the entries table({-bgcolor=>'454B74', -border=>'2', -bordercolor=>'8792BD', - +cols=>'2', -width=>'550', -height=>'550'}, [@rows] ), # end of table ), # end of div $locked = flock(MESSAGE,8); close(MESSAGE); exit 0; print $query->end_html;
gives me a syntax error. Any ideas of what I am doing wrong ?if $name =~ (/$Dealid/) {
2004-04-01 Janitored by Arunbear - added code tags, as per Monastery guidelines
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: If Statement
by dragonchild (Archbishop) on Apr 01, 2005 at 19:11 UTC | |
by kdelph (Initiate) on Apr 01, 2005 at 19:23 UTC | |
by dragonchild (Archbishop) on Apr 01, 2005 at 19:42 UTC | |
by kdelph (Initiate) on Apr 08, 2005 at 18:54 UTC |