Also note that $inp =~ s/\s+$//; will remove all trailing white space, including newlines (\n) and returns (\r).
Update: Correct typo (per reply).
In reply to Re^3: Strings mangled on printing
by RonW
in thread Strings mangled on printing
by gordu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |