use strict; use warnings; my($opsys) = "$^O"; print "Hello, your operating system is: $opsys" . "\n"; if ($opsys =~ /linux/) { my $ifconfig = "/sbin/ifconfig"; my @nic = qx |$ifconfig| or die ("Can't get info from ifconfig: $!\n"); for(@nic){ if (my ($device) = /eth(\d)/){ if (my ($ip) = /net addr:([\d.]+)/){ print "Device $device has the IP Address of $ip\n"; } } } } else { my $ifconfig = "ifconfig -a"; my @nic = qx |$ifconfig| or die ("Can't get info from ifconfig: $!\n"); for (@nic){ if (my ($device) = /^fjgi(\d)/){ if (my ($ip) = /inet ([\d.]+)/){ print "Device $device has the IP Address of $ip\n"; } } } }