#!/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
In reply to Re: Reaplcing double spaces
by blakem
in thread Replacing double spaces (was: Reaplcing double spaces)
by DaWolf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |