Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- my $ifconfig_output = `ifconfig`;
- if ($ifconfig_output =~ /inet (\d+\.\d+\.\d+\.\d+)/) {
- my $ip_address = $1; -- Ip address
- print "IP address: $ip_address\n";
- } else {
- print "IP address not found\n";
- }
- -- Your system must have ifconfig.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement