in reply to matching pattern question?
If so, in additional to AnomalousMonk's grep suggestion, several of the others above are solutions or near solutions with the addition of capturing parens:
#!/usr/bin/perl use strict; use warnings; use 5.012; my @captures; my $capture; my $string; my @strings = qw/0110 1 11 01110 001 100 1111 01001110/; for $string(@strings) { if ( $string =~ /^(.*?1{3}.*)$/ ) { push @captures, $1; } } for $capture(@captures) { say $capture; }
which produces:
01110 1111 01001110
|
|---|