in reply to Re^2: help with REGEXP to remove carriage return and caret from end
in thread help with REGEXP to remove carriage return and caret from end

I don't agree. From the OP's example it is clear his string is built as follows: 'some_name' + 'EOL-character(s)' + '^'.

chop removes the '^' and then chomp can do its usual job of handling the 'EOL-character(s)'.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^4: help with REGEXP to remove carriage return and caret from end
by GrandFather (Saint) on Jul 25, 2006 at 22:04 UTC

    The key word in my reply however was "generally" in the first sentence. Generally, as elaborated in my previous reply, chop is not such a useful function.

    Oh, I agree that it works for OP's problem as stated. But it is a fragile solution. Very likely that doesn't matter in OP's case. But in the interests of general education it is worth noting that chop is unfussy about what it removes and that chomp only removes trailing contents matching $/, and that $/ may contain anything.


    DWIM is Perl's answer to Gödel
      OK, in that case I generally agree with you! :-)

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law