Just a bit hard to tell what your ultimate intent is, but maybe something like:
>perl -wMstrict -le "my @reports = qw /doc_request doc_errors doc_types /; my %rpt = ( doc_request => [ qw(T_Doc_Request N_Doc_Request X_Doc_Request) ], doc_errors => [ qw(T_Doc_Errors N_Doc_Errors X_Doc_Errors ) ], doc_types => [ qw(T_Doc_Types N_Doc_Errors X_Doc_Errors ) ], ); ;; foreach my $report (@reports) { foreach my $section (@{ $rpt{$report} }) { do_something_with($report, $section); } } ;; sub do_something_with { my ($report, $section) = @_; print qq{report '$report', section '$section'}; } " report 'doc_request', section 'T_Doc_Request' report 'doc_request', section 'N_Doc_Request' report 'doc_request', section 'X_Doc_Request' report 'doc_errors', section 'T_Doc_Errors' report 'doc_errors', section 'N_Doc_Errors' report 'doc_errors', section 'X_Doc_Errors' report 'doc_types', section 'T_Doc_Types' report 'doc_types', section 'N_Doc_Errors' report 'doc_types', section 'X_Doc_Errors'
In reply to Re: Need more elegant solution
by AnomalousMonk
in thread Need more elegant solution
by dirtdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |