in reply to Re^2: Grep Pattern
in thread Grep Pattern
that's elegant...
$ ./1.grep_pattern.pl result is 1 2 5 6 9 10 $ cat 1.grep_pattern.pl #!/usr/bin/perl -w use 5.011; my @pat = ( 0, 1, 1, 0 ); my @result = grep { $pat[ $_ % @pat ] } 0..12; say "result is @result"; __END__ $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Grep Pattern
by LanX (Saint) on Dec 15, 2018 at 01:36 UTC | |
by ikegami (Patriarch) on Dec 15, 2018 at 15:48 UTC |