M
Mike Hunter
Hey everybody,
I'm having a weird problem. Check this out:
sub mth_inet_ntoa
{
my $stuff = shift;
$debug and print "mth_inet_ntoa_debug length \$stuff: ".(length $stuff)."\n";
my @o = split //, $stuff;
$debug and print "mth_inet_ntoa debug lengths ".
(length $o[0])." ".(length $o[1])." ".(length $o[2])." ".(length $o[3])."\n";
$debug and print "mth_inet_ntoa debug ".(join "", (unpack "b*", $stuff))."\n";
$debug and print "mth_inet_ntoa debug #".(join "", unpack "b*", $o[0]).
"#".(join "", unpack "b*", $o[1])."#".
(join "", unpack "b*", $o[2])."#".(join "", unpack "b*", $o[3])."#\n";
return "$o[0].$o[1].$o[2].$o[3]";
}
mth_inet_ntoa_debug length $stuff: 4
mth_inet_ntoa debug lengths 1 1 1 1
mth_inet_ntoa debug 00000001000001001010110000000000
mth_inet_ntoa debug #00000001#00000100#10101100#00000000#
Now, if I change from
split //, $stuff
to
unpack "CCCC", $stuff
I get these totally weirded-out results:
mth_inet_ntoa_debug length $stuff: 4
mth_inet_ntoa debug lengths 3 2 2 1
mth_inet_ntoa debug 00000001000001001010110000000000
mth_inet_ntoa debug #100011000100110000011100#1100110001001100#1010110011001100#00001100#
perl -V:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=freebsd, osvers=4.8-release, archname=i386-freebsd
...
Shouldn't unpack "CCCC" work?
Mike
I'm having a weird problem. Check this out:
sub mth_inet_ntoa
{
my $stuff = shift;
$debug and print "mth_inet_ntoa_debug length \$stuff: ".(length $stuff)."\n";
my @o = split //, $stuff;
$debug and print "mth_inet_ntoa debug lengths ".
(length $o[0])." ".(length $o[1])." ".(length $o[2])." ".(length $o[3])."\n";
$debug and print "mth_inet_ntoa debug ".(join "", (unpack "b*", $stuff))."\n";
$debug and print "mth_inet_ntoa debug #".(join "", unpack "b*", $o[0]).
"#".(join "", unpack "b*", $o[1])."#".
(join "", unpack "b*", $o[2])."#".(join "", unpack "b*", $o[3])."#\n";
return "$o[0].$o[1].$o[2].$o[3]";
}
mth_inet_ntoa_debug length $stuff: 4
mth_inet_ntoa debug lengths 1 1 1 1
mth_inet_ntoa debug 00000001000001001010110000000000
mth_inet_ntoa debug #00000001#00000100#10101100#00000000#
Now, if I change from
split //, $stuff
to
unpack "CCCC", $stuff
I get these totally weirded-out results:
mth_inet_ntoa_debug length $stuff: 4
mth_inet_ntoa debug lengths 3 2 2 1
mth_inet_ntoa debug 00000001000001001010110000000000
mth_inet_ntoa debug #100011000100110000011100#1100110001001100#1010110011001100#00001100#
perl -V:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=freebsd, osvers=4.8-release, archname=i386-freebsd
...
Shouldn't unpack "CCCC" work?
Mike