DelphiFAQ Home Search:
General :: Programming :: perl
General questions about perl.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Trim blank space at the beginning and end of a string


How do I strip blank space from the beginning/end of a string? In other language this is usually called Trim().


The best solution is doing it in two steps (faster than the typical first attempt to do it with one statement.

$string =~ s/^\s+//;
 $string =~ s/\s+$//;  

Generated 12:02:34 on Oct 17, 2019