ggadd has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Monks- Could someone explain why this code works perfectly in Perl v5.6.1 but not in v5.20.1? It imports a text file of names of bills and their due dates and converts to hash: CITI 5 AMEX 10 CHASE 20 Number on right becomes key, name is value:
open(my $fh, '<', 'c:/003/MYBILLS.TXT'); while(<$fh>) { my %hash = map{ chomp; split/ /; $_[1] => $_[0];} <$fh>; print$hash{20}; #prints CHASE
In v5.20.1 nothing will print here. But why? </p?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: newer Perl version rejects this
by davido (Cardinal) on Feb 08, 2015 at 05:45 UTC | |
by eyepopslikeamosquito (Archbishop) on Feb 08, 2015 at 10:45 UTC | |
by gabocze (Initiate) on Sep 17, 2016 at 22:03 UTC | |
by davido (Cardinal) on Sep 18, 2016 at 05:17 UTC | |
by ggadd (Acolyte) on Feb 08, 2015 at 14:13 UTC | |
|
Re: newer Perl version rejects this
by BrowserUk (Patriarch) on Feb 08, 2015 at 05:50 UTC |