Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Grep Pattern

by tybalt89 (Prior)
on Dec 12, 2018 at 15:41 UTC ( #1227152=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1227152]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2020-10-24 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (246 votes). Check out past polls.

    Notices?