#!/usr/bin/perl # # Get current IP address for my dynamic internet connection v0.0.1 # Copyright (C) 2006 Stian Skjæveland # # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # use strict; my @ifconfig=`/sbin/ifconfig`; my ($getif, $fixedif); $getif=substr($ifconfig[1], 20, 17); # get inet addr for eth0 from /sbin/ifconfig ($fixedif)=$getif=~/(.*)\s/; # match all possible IP addresses print $fixedif, "\n";