in reply to Re: whitespaces replace with tabs - help needed...
in thread whitespaces replace with tabs - help needed...

That only matches a space. The term 'whitespace' is much broader than a space--it includes things like newlines, tabs, etc. You want to match using \s, which matches any whitespace character.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Re: whitespaces replace with tabs - help needed...
by Theo (Priest) on Aug 14, 2003 at 14:42 UTC
    hardburn is right about what constitutes a whitespace, but I suspect that star7 may not be using the term correctly.
    I'm also confused, star7, when you say tabs are the problem. You seem to be putting tabs into your document. If they are the problem, wouldn't you be trying to remove them?

    $str =~ s/\t/ /g;

    Replacing each tab with a space. (not whitespace)

    -ted-

Re: Re: Re: whitespaces replace with tabs - help needed...
by monktim (Friar) on Aug 14, 2003 at 14:09 UTC
    Thanks. I realized that right after I clicked the submit button. Then I noticed someone else posted the s/\s/\t/g so I didn't bother updating my node. I'm new here, what is the policy? Should I fix my nodes even when someone beats me to the punch?

      Typically, a change to your node is done by putting a paragraph starting with a bold Update, followed by a note of the changes made.

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      Note: All code is untested, unless otherwise stated