in reply to Re^2: concatenating multiple lines without using . operator
in thread concatenating multiple lines without using . operator

It seems that what you are looking for is the "s" modifier for regex. Try:
$_ =~ s/[\s\r\n\t]//sg;
Also note - since the \s \r .. etc are alternative characters, and NOT a sequence, I have placed them in [brackets].

From the docs:

s     Treat string as single line. That is, change "." to match any character whatsoever, even a newline, which normally it would not match.
Update: Ignore the suggestion to use the "s" modifier. It is not necessary. See jwkrahn note below.

             I hope life isn't a big joke, because I don't get it.
                   -SNL

Replies are listed 'Best First'.
Re^4: concatenating multiple lines without using . operator
by jwkrahn (Abbot) on Jun 13, 2012 at 19:36 UTC
    what you are looking for is the "s" modifier
    ...
    change "." to match any character

    The pattern used does not contain the "." character class so why would the "s" modifier be needed?

      You are right - it is not necessary, and has no effect in that context.

      The node has been updated to reflect that, and acknowledge your catch. Thanks.

                   I hope life isn't a big joke, because I don't get it.
                         -SNL

Re^4: concatenating multiple lines without using . operator
by anonym (Acolyte) on Jun 13, 2012 at 13:54 UTC

    Thanks for the reply.I tried this but it is still printing in the same format. I am not sure where I am going wrong.

      So - you want to SLURP and CONCATNATE. Try replacing your entire WHILE loop with:
      do {local $/; ($seq{$chr}=<IN>)=~s/[\s\r\n\t]//g};

                   I hope life isn't a big joke, because I don't get it.
                         -SNL

        I think this might cause a problem since there will be occasional lines that look like >chr02 which are the sequence IDs and meant to be hash keys. Slurping like this would miss the transition between chromosomes or distinct DNA sequences.