in reply to Grep Pattern
Another one, with rotating:
P.S. note a wrong rotation direction. So, the pattern should be reversed before, if it's not a palindrome.#!/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";
|
---|
In Section
Seekers of Perl Wisdom