in reply to Re: splitting directly to hash
in thread splitting directly to hash

If you ran this code with use warnings; you would see a message like "Odd number of elements in hash assignment ... ". This is why the value for key '5' is undef rather than a space like all the others, as pointed out by chargrill.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^3: splitting directly to hash
by themage (Friar) on Nov 22, 2006 at 10:26 UTC
      Granted, if there is a trailing space then you will not get the warning. Semantically though, neither do you have a space separated format if you have a trailing space. Or it is a space separated format with a NULL last element. To my mind, whenever you have a something separated list, number of items plus number of separators is always odd. I'm not sure you could read too much into narashima's formatting given that no code was shown or <code> tags used.

      Cheers,

      JohnGG