Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $test = "Joe's Store"; my $log_file = "c:\log.txt"; open(LOGFILE, "$log_file") or die("Could not open log file."); while(<LOGFILE>){ my ($item) = $1 if /(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*? +)\*(.*?)$/; next if $seen{$item}; print "$item<br>"; print "$seen{$1}"; $seen{$item}++; } ____DATA__FILE Joe's Store N1*002113*pw12613x*DI*4/15/2004*11:58:46*1510043*1 Joe's Store N2*002113*pw12613x*DI*4/15/2004*11:58:46*1510043*1 Joe's Store N1*002113*pw12613x*DI*4/15/2004*11:58:46*1510043*1 Joe's Store N1*002113*pw12613x*DI*4/15/2004*11:58:46*1510043*1 Joe's Store N5*002113*pw12613x*DI*4/15/2004*11:58:46*1510043*1 Rental Company N1*002113*pw126513x*DI*4/15/2004*11:58:46*1510043*1 Joe's Store N6*002113*pw126513x*DI*4/15/2004*11:58:46*1510043*1 Joe's Store N1*002113*pw126513x*DX*4/15/2004*11:58:46*1510043*1 Joe's Store N8*002113*pw126513x*DI*4/15/2004*11:58:46*1510043*1 Joe's Store N9*002113*pw126513x*DI*4/15/2004*11:58:46*1510043*1 Rental Company N1*002113*pw126513x*DI*4/15/2004*11:58:46*1510043*1 Rental Company N2*002113*pw126513x*DI*4/15/2004*11:58:46*1510043*1 Travel X*003443*pw126513x*DI*4/15/2004*11:58:46*1510043*1 ___END_DATA__FILE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Uniqueness in Text Data File Help
by fizbin (Chaplain) on Apr 19, 2004 at 13:13 UTC | |
by aquarium (Curate) on Apr 19, 2004 at 13:52 UTC | |
by Anonymous Monk on Apr 19, 2004 at 13:57 UTC | |
by Anonymous Monk on Apr 19, 2004 at 13:35 UTC |