>>>>> "a" == addie  <ad...@refenestration.com> writes:

  a> #!/usr/bin/
  a> perl
  a> \

that is VERY strange line wrapping. please be careful how you paste code
so it doesn't do that. readers can't then paste the code and run it
without cleaning up the wrapped lines.

  a> use strict;
  a> use warnings;

  a> my %hash = ();

no need to initialize a lexical hash with ().
  a> my $key = '';
  a> open ACCESSIONS, "fix.txt" or die "Can't open fix.txt: $!\n";
  a> while (my $locus_line = <ACCESSIONS>){
  a> #This is supposed to populate
  a> %hash.

wrapping problem again.

  a>     %hash = split(/\s/, $locus_line);

that assigns a single pair to the hash. a SINGLE PAIR to the WHOLE
HASH. anything in the hash before that is wiped out. also the values
will have newlines on them which isn't the main bug but is usually wrong
when loading text from lines.

what you need to do is add elements to the hash for each line, not
assign the whole hash.

        my( $key, $val ) = split /\s/, $locus_line ;
        $hash{$key} = $val ;

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to