On Wed, Dec 12, 2001 at 05:42:11PM +0100, Jorge Goncalvez wrote:
> Hi I have this code:
> .......
> sub MakeEth()
> {     
>     unless ($_Globals{NICIP_ADRESS}==$IPREAL[0])
>     {
>         $_Globals{ETH_NETIF} eq "eth0";

You must have meant "=", not "eq", as in:
          $_Globals{ETH_NETIF} = "eth0";


>     }    
>     else{
>         
>         $_Globals{ETH_NETIF} eq "eth0:1";

Same here:
          $_Globals{ETH_NETIF} = "eth0";

>             
>          } 
> }
> 
> .......
> 
> sub StartDhcp()
> {
>     my $_cmd = $_Os{$_Globals{OS}}{DHCPD} .  " " . $_Globals{ETH_NETIF};
>     system($_cmd);
> }
> 
> I wanted to make $_Globals{ETH_NETIF} affected by what it is in the scope 
> MakeEth because in the sub StartDhcp $_Globals{ETH_NETIF} is undef I would to 
> make it a variable global after been affected by sub MakeEth.

You did not make %_Globals local to the MakeEth subroutine, so it is be
default global.  If you weren't seeing the results of the assignment it's
because you were using "eq" instead of "=".  "eq" is a comparison operator,
"=" is the assignment operator.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to