I have a script where I have captured the value on the left side of the "=" as the header for my table. Now I want to take the value on the right side of the "=" sign and populate a new row in table format where the header value I stored in the @header array matches the value on the left side of the "=" sign. Each dataset begins with a new line. If there is no match I would like to return null or just "" as the value.
Below is the script thus far. Any advice is greatly appreciated, Chris currently my output is just the header. I haven't been able to figure out how to do the rest. **OUTPUT** >csno,rfpi,vrp0,vrp1,trl,repl,repl_d1,rrl,row[1],rfpc0,rfpc1,row[4],line,row[15],tti #!/usr/bin/perl use warnings; use strict; my %seen; my @header; my $delim = ","; while( <DATA> ) { chomp; if($_ =~ /(.*)\=(.*)?/) { $seen{$1}++; if ($seen{$1} == 1) { push(@header,$1); } } } print join( "$delim",@header ),"\n"; __DATA__ >csno=1 rfpi=1 vrp0=3423000 vrp1=3423000 trl=1700000 repl=100 repl_d1=100 rrl=20 row[1]=yes rfpc0=0 rfpc1=0 >csno=1 rfpi=2 vrp0=3423000 vrp1=3423000 trl=1700000 repl=100 repl_d1=100 row[4]=no rrl=20 rfpc0=0 rfpc1=0 >csno=1 rfpi=3 vrp0=3423000 vrp1=3423000 trl=1700000 repl=100 repl_d1=100 rrl=20 rfpc0=0 rfpc1=0 >csno=2 rfpi=1 vrp0=3423000 vrp1=3423000 trl=1700000 repl=100 repl_d1=100 rrl=20 line=yes rfpc0=0 rfpc1=0 >csno=2 rfpi=2 vrp0=3423000 vrp1=3423000 trl=1700000 repl=100 repl_d1=100 rrl=20 rfpc0=0 line=value row[15]= tti=1 rfpc1=0 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/