Gossamer Forum
Home : Products : DBMan : Installation :

Can't declare scalar assignment

Quote Reply
Can't declare scalar assignment
Hello again-

I stated my (computed_rate = $rec{'Rate'});
within the sub_html_record:

my (%rec) = @_; # Load any defaults to put in the VALUE field.
my ($computed_rate = $rec{'Rate'});
($db_auto_generate and print &build_html_record(%rec) and return);

Then I tried to print it after the search was complete by putting this statment in the
sub html_view_success:

<body bgcolor="#DDDDDD">
<blockquote>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td colspan=2 bgcolor="navy"><FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Search Results</b>
</font></td></tr>
</table>
<p><$font>
print qq|Your Current Rate is $computed_rate.|; </font>
|;
if ($db_next_hits) {
print "<br><$font>Pages: $db_next_hits</font>";
}

And I'm getting an error message of:

Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: Can't declare scalar assignment in my at ./html.pl line 80, near ");"
syntax error at ./html.pl line 388, near "print qq|Your Current "
syntax error at ./html.pl line 389, near "|;"

Here is a example of what I'm tring to do:

When a user selects from the form his/her

Age , Gender , If they Smoke , the Plan (in years), if will bring up a rate.

So far the rate comes back when the search is finish. Which means it works,

But on the search result page, instead of it stating how many matches it received, state the current rate = $rec{'Rate'}

And in the table when the search data goes,
State the computed values.

Sorry so wordy, and I thank you for you fast responses.

cj3



Quote Reply
Re: Can't declare scalar assignment In reply to
 
Quote:
my ($computed_rate = $rec{'Rate'});

Oops, that should be either:

my $computed_rate = $rec{'Rate'}; # preferable

or:

my ($computed_rate) = $rec{'Rate'};

But that doesn't really solve the problem. When you say my $computed_rate, you are saying that the variable $computed_rate is only accessible in the subroutine html_record. Since you are trying to use it in view_records, it won't work!

You'll want to get the computed rate inside of view_success..

Hope that helps,

Alex
Quote Reply
Re: Can't declare scalar assignment In reply to
Thank you all for your help I got the problem
working.