my @data_tranfer_rt_25_count=grep ($newhash{ (m/(\w+)/)[0] }, @newlist +); ... $random_25_count = $#data_transfer_rt_25_count + 1;
The array @data_tranfer_rt_25_count and other, similar arrays seem to be used only to hold the elements produced by a grep so that the number of these elements can be determined later. This number can be determined directly:
>perl -wMstrict -le "my @ra = qw(a b c d e f); my $n = grep /[bcd]/, @ra; print qq{b or c or d: $n}; " b or c or d: 3
In more general terms, the three blocks of code you show seem to be doing rather similar things, but with different arrays.
.oO(Thinks: Function!)
Those are some pretty dense wadges of code there, pilgrim. Some whitespace/blank lines would be very much welcomed by these tired old eyes, and would help in sniffing out common code factors.
In reply to Re: How to reduce this lengthy code?
by AnomalousMonk
in thread How to reduce this lengthy code?
by hongping
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |