in reply to Can a regular expression include an arbitrary string variable?

#!/usr/bin/env perl my $string_to_find = 'hidden'; my @array_to_search = ('Foo', 'whathiddenever', 'Bar', '12hidden456'); my @matches = grep { /$string_to_find/ } @array_to_search; print "@matches";
  • Comment on Re: Can a regular expression include an arbitrary string variable?
  • Download Code