in reply to [perlre] grouping parenthesis capture whole string instead of proper subset... why?

| is used by Perl to mean OR - you probably need to escape it, like this:

$setstr =~ /(.*)\|\|$/

If you always want to remove two pipes from the end of a line, you could also use the substitute function:

$setstr =~ s/\|\|$//;

Hope this helps
--Foxcub

  • Comment on Re: [perlre] grouping parenthesis capture whole string instead of proper subset... why?
  • Select or Download Code