in reply to delete multiple string blocks
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: delete multiple string blocks
by grandagent (Novice) on Aug 08, 2019 at 11:21 UTC | |
by hippo (Archbishop) on Aug 08, 2019 at 13:13 UTC |