Find ip address using perl
Find ip address using perl
Script that will find out your ipaddress. This is very easy. I have written 2 kinds of script one is using
remote_addr() function and other is using the environmental variable $ENV{REMOTE_ADDR} in perl. Lets have a look at how the script looks. The remote_addr() uses the CGI module.
#!"C:/perl/bin/perl.exe" use CGI; my $q = CGI->new(); print $q->header().$q->remote_addr()."\n";
Since our other method is using perl environmental variable there is no need of calling CGI module.The script looks like this. This is much easier method without any complications of object oriented programming 🙂
#!"C:/perl/bin/perl.exe" print "Content-type: text/html \n\n"; my $rem_ip = $ENV{REMOTE_ADDR}; print $rem_ip;