in reply to Re: Help Me!
in thread Help Me!
You could do that without copying and shifting arrays:
my @tags = qw( ID Name Major Email ); #open FILE, '/home/ajb004/Paradigms/roster.txt' or die $!; while ( <DATA> ) { chomp; ## needed to get rid of \n on e-mail address s/_/ /g; # this doesn't need to be in the inner loop my %fields; my @fields{ @tags } = split /,/; #this is actually a regex print "<TR>\n"; foreach my $tag ( @tags ) { print " <TD>$tag: $fields{$tag}</TD>\n"; } print "</TR>\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Help Me!
by Marshall (Canon) on Apr 11, 2011 at 05:42 UTC | |
by jwkrahn (Abbot) on Apr 11, 2011 at 08:53 UTC | |
by Marshall (Canon) on Apr 13, 2011 at 08:14 UTC |