Some minor corrections.
On Thu, Sep 20, 2001 at 10:46:27AM -0400, Brian wrote:
> When comparing a variable with a string you must use 'eq'. So your
> example would look like:
When comparing a string with a string, you should always use 'eq'. That
it's in a variable is irrelevant.
> if($host eq 'access_1') {
> $host1 = 'ACESSO 1';
> }
> elseif($host eq 'access_2') {
> $host1 = 'ACESSO 2';
> }
>
> When using == with a string, it will always be true. Hope this helps
> you.
What if $host were "1"? The important part to note about this is that a
string, when evaluated in a numeric context, has to be turned into a number.
If the first character of the string is not a number, then the string
evaluates to 0; if, on the other hand, the string starts with numbers then
those numbers are used. For example, "400abcde" evaluates to 400 in numeric
context.
So, if $host were "1", then $host == 'access_2' would be false.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]