or download this
# extract the source IP addr into dotted quad form
my($source) = sprintf("%d.%d.%d.%d",
...
ord( substr($packet, $dst_ip+3, 1) ));
#the above part is directly taken from "hacking linux exposed" (sorry
+but couldn't figure out this part)