Try one of these:
$_=~ s/\s+//sg;
$_ =~ s/^\s+//; #Removing leading spaces
Nicu Ionita wrote:
> >
> > while ()
> > {
> > s/\s\s/\ /g;
> > print OUT $_;
> > }
> >
> >
> > (Assuming IN is an already open filehandle to the source file, and OUT is
> one to a destination file.)
>
> This doesn
>
> while ()
> {
> s/\s\s/\ /g;
> print OUT $_;
> }
>
>
> (Assuming IN is an already open filehandle to the source file, and OUT is
one to a destination file.)
This doesn't work. It's better:
while ()
{
s/\s{2,}/ /g;# these is a space
print OUT $_;
}
Nicu
__
s and ends of lines (possibly messing up your
indentation).
David
Levner
-Original Message-From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]On Behalf Of
[EMAIL PROTECTED]Sent: Saturday, November 22, 2003 1:58
PMTo: [EMAIL PROTECTED]Subject:
Removing double spaces from a
:58 AM
To: [EMAIL PROTECTED]
Subject: Removing double spaces from a file
What is the quickest and simplest method of ensuring a plain text file only has one
space between each word?
--
Rich Mellor
RWAP Services
35 Chantry Croft, Kinsley, Pontefract, West Yorkshire, WF9 5JH
TEL: 01977 610509
What is the quickest and simplest method of ensuring a plain text file only
has one space between each word?
--Rich
Mellor RWAP Services35 Chantry Croft, Kinsley, Pontefract, West
Yorkshire, WF9 5JHTEL: 01977 610509Visit our website
at:URL:http://www.rwapsoftware.co.ukIn need of adventu