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
__