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

One little thing. You can do this: (CORRECTED)

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

To replace instances from a set of characters, in this case whitespace or a tab. However, neither that nor what you have is actually necessary, as \s indicates any kind of whitespace, which with ascii means either a space or a tab. So just \s is fine.

The other thing is that is that what jwkrahn recommends:

$mailhouse{$f4} = [];

Is correct, but I would call it an anonymous array reference just to be completely clear (altho, of course, the only thing that can contain an anonymous array is a reference).

Replies are listed 'Best First'.
Re^2: A Hash that is giving me the ####s
by AnomalousMonk (Archbishop) on Sep 29, 2010 at 11:39 UTC
    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.

      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.)