I have a problem with the following perl script:
#!/usr/local/bin/perl -w
$ip="213.234.124.46";
$mask = "255.255.255.0";
@mask=split ('\.', $mask);
@ip=split ('\.', $ip);
$x = $mask[0];
$y = $ip[0];
$z = $x & ($y);
$u = $x & ($y+0);
print ("x = $x, y = $y, x&y = $z ($u)\n");
Its output is:
Use of uninitialized value at ip.pl line 9.
x = 255, y = 213, x&y = 211 (213)
I expected $z to have the same value as $u.
myconfig tells me:
Summary of my perl5 (patchlevel 1) configuration:
Platform:
osname=linux, osver=1, archname=i486-linux
uname='linux slarti 1.2.11 #1 tue aug 29 14:04:15 gmt 1995 i486 '
hint=previous
Compiler:
cc='cc', optimize='-O2'
cppflags='-Dbool=char -DHAS_BOOL -g'
ccflags ='-Dbool=char -DHAS_BOOL -g -DDEBUGGING'
ldflags =''
stdchar='char', d_stdstdio=undef, usevfork=false
voidflags=15, castflags=0, d_casti32=undef, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, randbits=31
Libraries:
so=sa
libpth=/lib /usr/lib /usr/local/lib
libs=-lgdbm -ldbm -ldb -lm -lc -lbsd
libc=/usr/lib/libc.sa
Dynamic Linking:
dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef
cccdlflags='', ccdlflags='', lddlflags=''
Werner Wiethege
Deutsche Bank
Systemtechnik
Alfred-Herrhausen-Allee 16-24
D-65760 Eschborn
Germany
email: werner@dbna.com
Tel.: (+ 49) 69 910 69155
FAX: (+ 49) 69 910 69273
----------------------------------------------------------------------
Opinions are my own and not necessarily shared by my employer.
#!/usr/local/bin/perl -w
$ip="213.234.124.46";
$mask = "255.255.255.0";
@mask=split ('\.', $mask);
@ip=split ('\.', $ip);
$x = $mask[0];
$y = $ip[0];
$z = $x & ($y);
$u = $x & ($y+0);
print ("x = $x, y = $y, x&y = $z ($u)\n");
Its output is:
Use of uninitialized value at ip.pl line 9.
x = 255, y = 213, x&y = 211 (213)
I expected $z to have the same value as $u.
myconfig tells me:
Summary of my perl5 (patchlevel 1) configuration:
Platform:
osname=linux, osver=1, archname=i486-linux
uname='linux slarti 1.2.11 #1 tue aug 29 14:04:15 gmt 1995 i486 '
hint=previous
Compiler:
cc='cc', optimize='-O2'
cppflags='-Dbool=char -DHAS_BOOL -g'
ccflags ='-Dbool=char -DHAS_BOOL -g -DDEBUGGING'
ldflags =''
stdchar='char', d_stdstdio=undef, usevfork=false
voidflags=15, castflags=0, d_casti32=undef, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, randbits=31
Libraries:
so=sa
libpth=/lib /usr/lib /usr/local/lib
libs=-lgdbm -ldbm -ldb -lm -lc -lbsd
libc=/usr/lib/libc.sa
Dynamic Linking:
dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef
cccdlflags='', ccdlflags='', lddlflags=''
Werner Wiethege
Deutsche Bank
Systemtechnik
Alfred-Herrhausen-Allee 16-24
D-65760 Eschborn
Germany
email: werner@dbna.com
Tel.: (+ 49) 69 910 69155
FAX: (+ 49) 69 910 69273
----------------------------------------------------------------------
Opinions are my own and not necessarily shared by my employer.