in reply to Parse file question
Maybe that a hash can help you :
#!/usr/bin/perl -w use strict; use Data::Dumper; my %buf; while( my $line = <DATA> ){ next unless $line; chomp $line; $line =~ s/,\s*$//; my $accnum = (split ',', $line)[3]; $buf{$accnum} = $line if $accnum; } print Dumper \%buf; __DATA__ 20080618,adfadf,adfadf,abc123,ljlkjll, 20080618,jfjfjf,bmbmbm,abc123,zzzdddd, 20080618,343434,959595,abc123,fjadfaf, 20080618,adfadf,adfadf,xyz123,ljlkjll, 20080618,adxxxf,gggsss,xyz123,ggaaddf, 20080618,dddfff,dfdfdd,xyz123,xxxxxd,
Output : $VAR1 = { 'xyz123' =>'20080618,dddfff,dfdfdd,xyz123,xxxxxd', 'abc123' =>'20080618,343434,959595,abc123,fjadfaf' };
hth,
PooLpi
|
|---|