in reply to Why are my hash keys undefined?
#!/usr/bin/perl use warnings; use strict; my %denovo; while (my $line = <DATA>){ chomp $line; if ($line =~ /([^,]*)$/){ my $name = "$1"; print "name is $name\n"; $denovo{$name} = $line; # Quotes not needed. } } print "hash denovo is:\n"; while( my( $key, $value ) = each %denovo ){ print "$key: $value\n"; } __DATA__ no comma comma, in the middle comma at the end, previous line was empty
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why are my hash keys undefined?
by Anonymous Monk on Feb 08, 2016 at 17:43 UTC | |
by choroba (Cardinal) on Feb 08, 2016 at 17:46 UTC | |
by biologistatsea (Acolyte) on Feb 09, 2016 at 13:52 UTC |