Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Perl Things

Quote Reply
Perl Things
From: jerrysu
Received: 12-Aug-00 04:34 PM
ok.. inside the () there is a true or false statement.. all the time..

using '=' is an assignment...
using '==' or 'eq' are for comparisons.. == for numbers.. eq for anything else..

if you do $package = "Links".. this will be true.. because package = Links..

if ($package = "Links") {.. what this does.. it first assigns the value of $package to Links.. and then the statement sort of internally turns into..

if ($package) {.. so.. $package has a value.. so it is true.. the value is Links..

if you did like.. if ($package = "") {.. it would always return false..
--------------
Hi Jerrysu and thank you for your advice.
So it is:

if ($var) the same as if (var=12)

and if i would do the rigth quest for 12, i must set:

if ($var == "12") for chars, if ($var eq "12") for numbers.
and ($var == "$a") means compare with value of $a; (var == '$a') means compare with string $a, but this is false cause $a is no number and so it is 0? I must be then (var eq '$a'), right?
---
Just another thing i dont understand and have big problems with:

In add.cgi and modify.cgi; there are some calls like &function in html_templates (...) and return;
some without 'and return';

i cant see any pattern;

my problem is, that i have rewright both cgis completly. (i have build in a confirm and some other things and so i need a proove on 'validated before' before the add_record call e.g.)

But i still such with the modify, cause the script hangs up my browser (but runs till end)
as i play around with the return command i could retest this hanging.
---
Just another thing i dont understand:

in modify.cgi 'add_record' is called only with one passed var '$links'; in add there are two: %rec and %in
but add_record works with both vars ???

Robert

























Quote Reply
Re: Perl Things In reply to
urgh.... you got it the wrong way.. == for numbers.. eq for strings..



Jerry Su
Quote Reply
Re: Perl Things In reply to
Yes , i ment this :-)

Robert