On Aug 10, Tim McGeary said:
Jeff 'japhy' Pinyan wrote:
my @field_names = qw( ID name_f name_l email id contact group member ); my %long_names; @[EMAIL PROTECTED] = ( 'ID', 'First Name', 'Last Name', 'Email Address', 'id', 'Contact', 'Group', 'Member', );
while (<INPUT>) { chomp; my %record; @[EMAIL PROTECTED] = split /,/; if (my @empty = grep length $record{$_} == 0, @field_names) { empty_fields(@empty); } else { # process record } }
Where the empty_fields() function would do something like:
sub empty_fields { my $msg = "You left these fields empty: "; $msg .= join ", ", @[EMAIL PROTECTED]; # displays $msg to the user somehow }
This makes my output unordered and extraneous. I don't want to field_names to output, so I don't think a hash works for this. But in its essense, it is what I need to do. I just need to keep the field_names from outputting, too. Just the data, in the same order I bring it in.
You could use an array instead of a hash, then. But the output isn't unordered if you make @field_names hold the names in the order you want them used.
How do I force that AND not output both parts of the hash since I just want the values, not the keys.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>