#!/usr/bin/perl -w #distlog.pl use strict; use IO::File; my %output_handles; while (<>) { unless (/^(\S+):/) { warn "ignoring the line with missing name: $_"; next; } my $name = lc $1; my $handle = $output_handles{$name} ||= IO::File->open(">$name.info") || die "Cannot create $name.info: $!"; print $handle $_; }