http://www.perlmonks.org?node_id=1227152


in reply to Re^2: Grep Pattern
in thread Grep Pattern

Just invert the pattern and the test :)

#!/usr/bin/perl -l # https://perlmonks.org/?node_id=1227147 use strict; use warnings; my $pattern = '011'; my @result = grep !($pattern =~ /./g && $&), 0..12; local $, = ','; print @result;

Outputs:

0,3,4,7,8,11,12