in reply to Assigning to a hash

Assuming $columns[0] is a user name , this should work fine. I would imagine, that either $columns[0] is not populated correctly, or something more siniter is afoot ... something like a \r or \n on the username. I think adding a print above this so you can check $columns[0] would be a good idea. Also, if you show some more code, we might be able to help more.
i had a memory leak once, and it ruined my favorite shirt.

Replies are listed 'Best First'.
Re: Re: Assigning to a hash
by willa (Acolyte) on Dec 03, 2001 at 22:07 UTC
    The perl debugger shows $columns[0] as 'willa', so I don't think any special chars are lurking...
      Is this data being read from a file ? a database? Knowing where it comes from may help me formulate a guess. What you have should work fine. If you do something like the following , does it work any better (not that it should) :
      my $key = $columns[0]; $hash{$key} = 1;

      Also, you may want to use Data::Dumper to print out the data structure to find out what is getting created.
      $ perl -e 'do() || ! do() ;' Undefined subroutine &main::try
      Weird. If $columns[0] is defined correctly, you'd think that would work. Maybe posting more code would help.
      Also, check here for other ways to Return a Unique Array.
      Rich36
      There's more than one way to screw it up...