in reply to simple regex question
You could try something like this:
#!/usr/bin/perl use strict; use warnings; $|++; use 5.010; my $before = 'foo'; my $after = 'stuff'; my $pattern = 'blablah'; my $combined = $before . $pattern . $after; my @test = qw( blahblahblah stuffstuffstuff fooblablahstuff fooblahblahstuff onefooblablahstuff ); match($_) for(@test); sub match { my $test = shift; say "$test matches" if( $test =~ /$combined/o ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: simple regex question
by JavaFan (Canon) on Nov 26, 2010 at 15:08 UTC | |
by phenom (Chaplain) on Nov 26, 2010 at 15:16 UTC | |
by Marshall (Canon) on Nov 27, 2010 at 04:56 UTC | |
by JavaFan (Canon) on Nov 27, 2010 at 11:10 UTC |
In Section
Seekers of Perl Wisdom