in reply to Replacing double spaces (was: Reaplcing double spaces)
#!/usr/bin/perl -wT use strict; my $txt = " apple bannana lemon "; print "Before: '$txt'\n"; $txt =~ s/(^\s+)|(\s+$)//g; # remove leading and trailing spaces; $txt =~ s/\s+/\|/g; # collapse multiple spaces into a singl +e '|' print "After: '$txt'\n"; =output Before: ' apple bannana lemon ' After: 'apple|bannana|lemon'
-Blake
|
|---|