The original script has both -w and strict on, and no warnings are
generated. So everything is ok except param perhaps. The value of param
is some how sticky. 

-----Ursprüngliche Nachricht-----
Von: Dan Muey [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 3. September 2003 20:00
An: B. Fongo; [EMAIL PROTECTED]
Betreff: RE: if-else-statement


> Hello

Hello again.

> 
> Below is a  portion of a script that displays a table. The 
> argument passed by param() determines the number of rows the 
> table should display. 
> For some unknown reason, the value of param() seem to behave 
> strangely. It at times the value does not change; even if a 
> different number is sent as an argument to the script.  What 
> is wrong in the conditional statement or param(). I tried "my 
> $value_of_param " and "use vars qw($value_of_param)"  but the 
> value remains unpredictable.  

Put 
use strict;
 at the top of your script and either -w after the shebang line or 
use warnings; if perl -v is 5.6 ish.

Then run the script and see what those thigns tell you.

HTH

DMuey
> 
> Thanks for any help
> 
> 
> #####################################################
> 
> @links = (1..$pages) if $pages;
> foreach $link (@links){
>             
> print qq(<a href='?action=$link'>&nbsp; [$link] &nbsp;</a>); 
> # Clicking the link sends the value to this script as parameter. }
>    
> #my $value_of_param;
> use vars qw($value_of_param);
> 
> if ($obj->param('action')){
>       $value_of_param = $obj->param('action');
>          if ($value_of_param == 1){
>             
>             $sql = "$query LIMIT 0, $max_rows";        
>          }
>          elsif ($value_of_param == 2){
>             $sql = "$query LIMIT 51, $max_rows";
>        }
>        else {
>           $start_po += ((50 * $value_of_param) + 1);
>           $sql = "$query LIMIT $start_po, $max_rows";
>        }
> 
>    }
>    else {
>       $sql = "$query LIMIT $start_po, $max_rows";
>    }
> 
> # See value of  param() :
> print qq($value_of_param) if ($value_of_param);
> 
> 
> 
> 
> 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to