in reply to Re: Ignore a range of numbers ina List
in thread Ignore a range of numbers ina List
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my $aref = [ 6, 7, 1, 6, 8, 9, 7, 2, 6, 98, 99, 7, 3, 7, 4, 6, 5, ]; dd $aref; ;; my @copy; $_ == 6 .. $_ == 7 or push @copy, $_ for @$aref; ;; dd \@copy; " [6, 7, 1, 6, 8, 9, 7, 2, 6, 98, 99, 7, 3, 7, 4, 6, 5] [1, 2, 3, 7, 4]
What's supposed to happen if a "start" code for an exclusion sequence is seen, but no corresponding "stop" code is ever seen? My assumption was that no exclusion would happen. I expected
[6, 7, 1, 6, 8, 9, 7, 2, 6, 98, 99, 7, 3, 7, 4, 6, 5]
to yield
[1, 2, 3, 7, 4, 6, 5]
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Ignore a range of numbers ina List
by CountZero (Bishop) on Jun 25, 2017 at 08:09 UTC | |
by AnomalousMonk (Archbishop) on Jun 25, 2017 at 09:22 UTC | |
|
Re^3: Ignore a range of numbers ina List
by shmem (Chancellor) on Jun 25, 2017 at 07:19 UTC | |
by AnomalousMonk (Archbishop) on Jun 25, 2017 at 07:54 UTC |