I have a very simple problem which is driving me slightly mad. The question relates to a variable named @unique_slopes which is within a few nested loops. When I print the contents of the variable it contains many numbers (is this just because it is within the loops??). I need all these numbers I store in @unique_slopes to be in the same array (so I can iterate through it and find what i'm after). Is there a better way for me to store these numbers so that I can split the array and iterate through it? I eventually want to use the for loop at the bottom but am just having problems as everything in @unique_slopes is in $unique_slopes[0].
Cheers monks.
This is what I eventually want to do with @unique_slopesforeach my $line (@data) { # lots of irrelevent code for (my $i =1; $i < @array; $i++) { # once again lots of irrelevent code %gradient_hash = map {$matching_temps[$_] => $gradients[$_]} 0 .. + $#matching_temps; while (($key2, $value2) = each (%gradient_hash)) { if (($value2 > 0.1) || ($value2 < -0.1)) { @steep_grads = $key2 . '?' . $value2; @slopes = $value2; } } @unique_slopes = grep {! $seen2{$_} ++} @slopes; print "@unique_slopes<P>"; } }
for (my $i = 1; $i < @unique_slopes; $i++) { if (($unique_slopes[$i] < -0.1) && ($unique_slopes[$i-1] > 0.1)) + { print "PEAKS: $unique_slopes[$i-1] $unique_slopes[$i]<P>"; } }
update (broquaint): added formatting + removed extraneous whitespace in code
In reply to going loopy by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |