in reply to Strip brackets and contents from string
But this does not work where the brackets contain only text.
Works for me:
#!/usr/bin/env perl use strict; use warnings; use Test::More; my %foo = ( 'a(b)c' => 'ac', 'ab()cd' => 'abcd' ); my $snr = qr/\(.*?\)/; for my $have (keys %foo) { my $want = $foo{$have}; $have =~ s/$snr//sg; is ($have, $want); } done_testing ();
"It doesn't work" is as useful to a developer as "I'm ill" is to a medic. Try to be more specific.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strip brackets and contents from string
by BrowserUk (Patriarch) on Apr 11, 2016 at 20:57 UTC |