Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Grep Pattern

by tybalt89 (Monsignor)
on Dec 12, 2018 at 15:41 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1227152]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2024-03-28 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found