# it goes a little like this while () { my ($Name, $Host, $Port, $Rest)=unpack('A15A10A10A*', $_); # now do what you will with them }