#!/usr/local/bin/perl -T use strict; use warnings; my ( $id, $port, $description ); while(<>) { chomp; # Ignore comments. next if /^#/; # Do very rudimentary syntax checking on the ID and port fields ( $id, $port, $description ) = m#^\s*(\w+-\w+)\s+(\w+/\d+/\d+)\s+(.*)$#; # Here in my real program I do some database stuff. print "ID: $id, Port: $port, Description: $description\n"; }