in reply to Re^2: remove first and last character of string
in thread remove first and last character of string

My test proves that my solution satisfies the only test-case you have provided. Please replace my $string and $expected values with a case that fails. Post the complete test. Perhaps then, we can understand your problem. If you really want to unconditionally remove the first and last character of the string, I like the AnomalousMonk solution of substr with a length of -1. (I never would have thought of that myself.)
Bill
  • Comment on Re^3: remove first and last character of string