in reply to formatting help
save the above line of code to a filewhile(<>){ # read through each file specified on the command line one + line at a time my @temp = split(',',$_); # take that one line and split it into a +n array determined by the commas my ($section,$value1,$value2) = ($temp[6],$temp[12],$temp[18]); # +set names to specific spots for readability $section =~ s/\"//g; # remove the ", you may have to remove 'g' to + make this work $value1 =~ s/\"//g; # it's off the top of my head ;) $value2 =~ s/\"//g; $ALLDATA{$section} = push [($value1,$value2)]; #put an array of tw +o numbers into an array those } # end while<> foreach my $key (sort keys %ALLDATA) { # go through each section (in o +rder) print "$key\n"; foreach my $array (@{$ALLDATA{$key}}) { print "\t"; foreach my $value (@{$ALLDATA{$key}[$array]} { print "$value,"; } print "\n"; } print "END_SECTION\n"; }
perl progname.pl < datafilename >email me if it dosen't work achesser@nortelnetworks.com
i wrote that off the top of my head
- Comment on Re: formatting help
- Download Code