in reply to Re: A Hash that is giving me the ####s
in thread A Hash that is giving me the ####s

s/[\s|\t]//g;

If the  \t in the  [\s|\t] character set had been some non-redundant, non-whitespace character and thus not subject to removal, a potential problem would have remained. The  | (pipe) character in the set is a literal '|', not the regex alternation metacharacter, so the set would have contained an extraneous character – perhaps the basis of a subtle bug. A regex character set implies alternation.

Replies are listed 'Best First'.
Re^3: A Hash that is giving me the ####s
by halfcountplus (Hermit) on Sep 29, 2010 at 14:41 UTC

    Egads!! My bad AnomalousMonk, and much thanks; I had not noticed that about [] -- looks like I have a few scripts to grep thru and correct. Heh-heh. I've also changed the above post. Point being:

    s/\s|\t//g;

    Is more or less equivalent to:

    s/[\s\t]//g;

    Whereas:

    s/[\s|\t]//g;

    Contains that subtle flaw with the pipe. (But again, just \s will do in this case anyway.)