A) There was no test case for that indicating it is not possible for his data set.
B) This is one thing I really like about perl - it's easily fixed with just two words and a comma :)
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11121442 use warnings; my @data = qw( 5 ); my $target = 5; my @answers = grep defined, map { $data[$_] == $target ? @data[$_ + 1 +.. $_ + 3] : () } 0 .. $#data; print "@answers\n";
In reply to Re^3: Manipulating Array Indexes
by tybalt89
in thread Manipulating Array Indexes
by TJ777
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |