Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Grep Pattern

by rsFalse (Chaplain)
on Dec 15, 2018 at 20:06 UTC ( [id://1227304]=note: print w/replies, xml ) Need Help??


in reply to Grep Pattern

Another one, with rotating:
#!/usr/bin/perl # https://perlmonks.org/?node_id=1227147 use warnings; use strict; my $short_pattern = 'FTTF'; my @result = grep { $short_pattern = ( chop $short_pattern ) . $short_patt +ern; $short_pattern ge 'T' } 0 .. 12; print "@result\n";
P.S. note a wrong rotation direction. So, the pattern should be reversed before, if it's not a palindrome.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-18 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found