use strict; use warnings; my $ip; open CMD, '-|' or exec qw(/sbin/ifconfig ppp0) or die "exec failed: $!"; foreach() { $ip = $1 if m/^\s*inet addr:([0-9.]+)/; } close CMD; print $ip ? "Deine IP: $ip\n" : "IP nich gefunden :-(\n";