http://www.perlmonks.org?node_id=688683


in reply to parsing system info

$ echo `hostname -i; hostname -f` 10.1.9.183 jboss-box1.domain.com

Either run them separately, or split the output at whitespaces.

eth0 Link encap:Ethernet HWaddr 00:0C:29:3D:6B:CF inet addr:10.1.9.183 Bcast:10.1.9.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe3d:6bcf/64 Scope:Link Interrupt:177 Base address:0x1424 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host

The interface name is simply m/^(\w+)/, What other informations do you want to extract?

$ uname -a Linux jboss-box1 2.6.9-67.0.7.ELsmp #1 SMP Sat Mar 15 06:54:55 EDT 200 +8 i686 i686 i386 GNU/Linux

Run uname several time with more specific options

And so on - there's not one all-empowering parsing paradigm - just chose what you see fit. For fixed width records you could use unpack btw - see perlpacktut.