in reply to trimming space from both sides of a string
I guess that I’m just a lazy sot. :-)
I like to use the Text::Trim module.
This package gives you the ltrim, rtrim, trim functions that you have come to expect ... and that later Perls actually provide. Obviously, it is an uncomplicated module and therefore, “not the only way to do it,” but I like it because it helps me to SWIM = Say What I Mean.