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
    "It doesn't work" is as useful to a developer as "I'm ill" is to a medic. Try to be more specific.

    ++ for the accurate analogy. If I could cast another vote for the content of your post I would :)


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.