Your syntax looks fine, but the warning probably indicates that the
variable ( $sth_display->{NAME}->[$c] ) is undefined. Check it with
defined() and print out ' ' or something if it isn't defined.
i.e. ( using trinary conditional operator )
defined( $sth_display->{NAME}->[$c] ) ? print
"<td>$sth_display->{NAME}->[$c]</td>" : print "<td> </td>";
should get rid of the warning;
Ian.
____________________________________________________________
Ian Macdonald
On Tue, 17 Apr 2001, David Humpherys wrote:
> when i run a script that has the following bit of code I get an warning:
> use of uninitialized value in concatenation (.) at....
> I get it for the line: if (($sth_display->{NAME}->[$c]) !~ /id/i)
>
>
> Is my syntax correct here.? The program runs (occasionally) and i get
> appropriate results...I just want to get rid of my warnings.
>
>
> &ConnectDB;
> $sth_display = $dbh->prepare_cached("$mystatement") || print "Can't prepare
> statement.\n";
> $sth_display->execute;
>
> for ($c=0; $c < $sth_display->{NUM_OF_FIELDS}; $c++){
> if (($sth_display->{NAME}->[$c]) !~ /id/i) { #if it isn't an id_field
> print <<"HERE";
> <td>$sth_display->{NAME}->[$c]</td>
> HERE
> }
> }
>
>
> thanks
> david
>