use strict;
use warnings;
use Data::Dumper;
my %hash;
while (my $line = <DATA> ) {
chomp($line);
$line =~ m/^(\d+_\d+_\d+);/;
$hash{$1} .= "$line\n";
}
for my $outfile (keys %hash ){
if ( -e "$outfile.log" ){
next ;
}
open (WRT,">$outfile.log") or die "cannot open file : $!";
print WRT "$hash{$outfile}";
close ( WRT ) ;
}
__DATA__
3_21_2010;11:12\\trafic info
3_21_2010;11:34\\trafic info
3_21_2010;13:21\\trafic info
3_22_2010;11:12\\trafic info
3_22_2010;11:34\\trafic info
3_22_2010;13:21\\trafic info
3_22_2010;11:12\\trafic info
3_23_2010;11:34\\trafic info
3_23_2010;13:21\\trafic info
3_23_2010;13:21\\trafic info
3_24_2010;11:12\\trafic info
3_24_2010;11:34\\trafic info
3_24_2010;13:21\\trafic info
~