use Socket; socket(SOCK,PF_INET,SOCK_RAW,getprotobyname('icmp')) || die "Error: $!\n"; $msg = pack("C2 n3",8,0,32127,0,1); print "the value of checksum is:", unpack('H4', pack('n',32127)), "\n"; print "[And you should see this in your tcpdump -i lo icmp -xxx]\n"; send(SOCK,$msg,0,sockaddr_in(0,inet_aton('localhost'))) || die "Error: $! \n";