in reply to Why does every value of the array get replaced?
use warnings; #use strict; use Data::Dumper; my @array1 = 1..4; my @array2 = 2..6; foreach $G (@array1){ for $x (0..$#array2){ if($array2[$x] =~ /$G/){ push(@Coordinates,"$array2[$x]"); } } } print Dumper(\@Coordinates); __END__ $VAR1 = [ '2', '3', '4' ];
See also the Basic debugging checklist
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why does every value of the array get replaced?
by GotToBTru (Prior) on May 27, 2015 at 18:27 UTC |