TIMTOWTDI. It's pretty simple so long as you assign to a lexical in your while loop. eg:
#!/usr/bin/env perl use strict; use warnings; my @substrings = qw/XLON_DBX1AE_USD XLON_DBX1AE_GBP/; while (my $line = <DATA>) { if (grep { index ($line, $_) > -1 } @substrings) { print "Found a match in line: $line"; } } __DATA__ strategies{ XLON_DBX0F2_GBP DynamicSpreadQuoter { tradingServiceAttributes { session LSE1 } fairPrice { securityID LU0490618542 securityIDSource 4 service IDNPS } } XLON_DBX1AE_GBP DynamicSpreadQuoter { tradingServiceAttributes { session LSE3 } fairPrice { securityID LU0322252127 securityIDSource 4 service NMP_ABPS } } XLON_DBX1AE_USD DynamicSpreadQuoter { tradingServiceAttributes { session LSE1 } fairPrice { securityID LU0322252171 securityIDSource 4 service NMP_ABPS } } ;; }
I've assumed here that your patterns are all substrings rather than regular expressions.
In reply to Re: delete multiple string blocks
by hippo
in thread delete multiple string blocks
by grandagent
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |