in reply to Re: How to remove white space and more than a particular number of new lines!
in thread How to remove white space and more than a particular number of new lines!

I tried to capture whitespaces with /^\s*$/ but its not working. Can you pls show the correct way please
  • Comment on Re^2: How to remove white space and more than a particular number of new lines!

Replies are listed 'Best First'.
Re^3: How to remove white space and more than a particular number of new lines!
by graff (Chancellor) on Apr 14, 2014 at 02:06 UTC
    Show us the actual code that you used when you "tried to capture whitespaces". Also tell us what "its not working" really means: what did it do, and how did that differ from what you wanted to do. These details will help us help you.

      i used this,

      $string =~ s/\t/ /g; $string =~ s/^\s*$//g;

      but the white spaced lines was not getting replaced.

        Are you sure there is nothing but whitespace on the whole line?
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ