Is there a built-in function to trim leading and trailing whitespace such that trim(\" hello world \") eq \"hello world\"?
trim(\" hello world \") eq \"hello world\"
One option is Text::Trim:
use Text::Trim; print trim(" example ");