in reply to Re: problem with removing space
in thread problem with removing space

Note that you can also use tr to squash multiple whitespace characters into single _s:

$_= " This is \t a test\cM\n"; tr/ \t\f\r\n/_/s; print; __END__ prints "_This_is_a_test_"

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: problem with removing space
by suaveant (Parson) on Apr 03, 2001 at 21:56 UTC
    Ahhh... I never got into using tr... just one of those things... I should. So how do you make tr trade one for one?
    tr/ \t\f\r\n/_____/
                    - Ant

      No, you just leave the "s" off the end.

              - tye (but my friends call me "Tye")
        Ooops, missed the s when I read the reply... my bad :)
                        - Ant