Hi, You may find it easier to locate errors in your code if it were restructured to clarify and simplify the logic and eliminate many brackets. Here is an example, it may not do exactly what you want but I hope this gives you the idea.
#!/usr/bin/perl use DBI ; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); my($username)= "someuser"; my($password)= "knownuser"; my($dbh)= DBI->connect ("DBI:mysql:hf", $username , $password); my($empName)= param("empName"); my($year) = param("year"); my($mon) = param("mon"); DBI -> trace(4 , 'dbitrace'); # logic my $result; if ($year && $mon){ $result = getResult($empName); } else{ $result = "Select year and month. <br>"; } # result print <<end_of_html; Content-type: text/html <html><head><title> Job Status Display Page</title></head> <body> $result <a href="/jsdisp.html" > Back </a> </body></html> end_of_html #process sub getResult { my $empName = shift; my $table = q!<table border="1" height="8%"> <tr valign="center" align="middle"> <td width="10%">Current Date</td> <td width="10%">Name</td> <td width="15%">Job Allocated</td> <td width="10%">Allocation Date</td> <td width="10%">Target Date</td> <td width="15%">Job Under Execution</td> <td width="15%">Job Pending </td> <td width="15%">Remark </td> </tr>!; my $date1 = $year.$mon.'00'; my $date2 = $year.($mon++).'00'; my $sql = "select * from jobStat where cdate > ? and cdate < ?"; my $noMsg = "No records found for given date.<br>"; if ($empName){ $sql .= " and empName='$empName'"; $noMsg = "No records found for $empName for given date.<br>"; } my $sth = $dbh->prepare($sql); $sth->execute($date1,$date2); my $count=0; while (my @arr = $sth->fetchrow_array){ $table .= qq!<tr valign="center" align="middle"> <td>$arr[5]</td> <td>$arr[8]</td> <td>$arr[1]</td> <td>$arr[6]</td> <td>$arr[7]</td> <td>$arr[2]</td> <td>$arr[3]</td> <td>$arr[4]</td> <tr>!; ++$count; } if ($count==0){ return $noMsg; } else { $table .= q!</table>!; return $table; } }
poj

In reply to Re: Missing right curly or square bracket at jsdisp.cgi line 178, at end of line syntax error at jsdisp.cgi line 178, at EOF by poj
in thread Missing right curly or square bracket at jsdisp.cgi line 178, at end of line syntax error at jsdisp.cgi line 178, at EOF by gvs_jagan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.