open (INPUT, $input) || die "Cannot open input file: $!\n"; while ($line = ) { # format the record and write to a new file } close INPUT || die "Cannot close input file: $!\n";