Win has asked for the wisdom of the Perl Monks concerning the following question:
... into a lookup hash so that I can perform operations like the following:my @x_values_for_points_above_the_trend_line; my @y_values_for_points_above_the_trend_line; my @distances_above_the_trend_line; my @x_values_for_points_below_the_trend_line; my @y_values_for_points_below_the_trend_line; my @distances_below_the_trend_line; my @x_values_for_points_on_the_trend_line; my @y_values_for_points_on_the_trend_line; # The contents of these arrays have corresponding values in the same a +rray positions.
...... with the added functionality of printing out each region in the array @regions_A_array with the $distances_below_the_trend_line[$pos] value.my $count_A = -1; my @regions_A_array; foreach (@x_values_for_points_above_the_trend_line) { $count_A++; my $x_value_SM = $_; my $y_value_SM = $y_values_for_points_above_the_trend_line[$count_A] +; my $Select_area_above_trendline = " SELECT DISTINCT A.Region FROM Temp_table_A A, Temp_table_B B WHER +E A.Region = B.Region AND A.SM = ".$x_value_SM." AND B.SM = ".$y_valu +e_SM." "; my $sth_atl = $dbh->prepare($Select_area_above_trendline) or die "Co +uldn't prepare query: ".$dbh->errstr; $sth_atl->execute() or die "Couldn't execute query: ".$sth_atl->errs +tr; my @regions_A; while (@regions_A = $sth_atl->fetchrow_array) { push (@regions_A_array, @regions_A); } my @regions_A_array = r(@regions_A_array); # This is to remove du +plicates from the array } # The subroutine below removes duplicates sub r{ keys%{{map{$_,1}@_}} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Making do with a badly designed process
by amarquis (Curate) on Jan 18, 2008 at 15:16 UTC | |
|
Re: Making do with a badly designed process
by Anonymous Monk on Jan 18, 2008 at 13:42 UTC |