in reply to ensure ALL patterns in string
Why do you want the shortest? Here's one way to do it.
#!/bin/env perl use strict; use warnings; use List::Util qw(all); my $var = 'xyz'; if ( all { $var =~ $_ } ( qr/x/, qr/y/, qr/z/ ) ) { print "all in m8\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ensure ALL patterns in string
by previous (Sexton) on Jan 22, 2016 at 21:40 UTC | |
by ExReg (Priest) on Jan 25, 2016 at 15:20 UTC |