When comparing a variable with a string you must use 'eq'. So your
example would look like:
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.
NOTE: I didn't really test the above code, so there may be a type-o in
there (sometimes my fingers work faster than my brain).
-Brian Johnson
Check your pop3 email online from anywhere!
http://e-mol.business-professionals.net
Written in Perl by Perl lovers
> Hi,
>
> I have another simple question:
> In my script i have a variable $host that is a string... I'm
> trying to do a
> conditional like this:
>
> if ($host == 'access_1') {
> $host1 = 'ACESSO 1' ;}
> elsif ($host == 'access_2') {
> $host1 = 'ACESSO 2' ;}
>
> The problem is that $host1 aways get the first valur (ACCESSO
> 1) even if its
> value is access_2...
>
> I may be doing some mistake in the if line....
>
> Thanks,
> Wagner
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]