From: Peter J. Holzer on 9 Jun 2010 16:01 On 2010-06-08 18:26, Uri Guttman <uri(a)StemSystems.com> wrote: >>>>>> "c" == ccc31807 <cartercc(a)gmail.com> writes: > c> 0123456 => HASH(deadbeed) > c> id => 0123456 > > that is an OCTAL literal. It isn't a literal at all. It's a string read from a file. hp
From: ccc31807 on 9 Jun 2010 16:49 On Jun 9, 4:00 pm, "Peter J. Holzer" <hjp-usen...(a)hjp.at> wrote: > On 2010-06-08 21:12, ccc31807 <carte...(a)gmail.com> wrote: > > > > > #! perl > > # array.plx > > use strict; > > use warnings; > > my %presidents; > > while (<DATA>) > > { > > chomp; > > my ($order, $first, $last, @years) = split /\|/; > > $presidents{$order} = { > > first => $first, > > last => $last, > > years => @years, > > }; > > } > > > foreach my $k (sort keys %presidents) > > { > > print "$k => $presidents{$k}\n"; > > foreach my $k2 (sort keys %{$presidents{$k}}) > > { > > print " $k2 => $presidents{$k}{$k2}\n"; > > } > > } > > exit(0); > > This script never pads $order to two digits. > > > __DATA__ > > 1|George|Washington|1788 1792 > > ^ here $order has only one digit.> 2|John|Adams|1796 > > 3|Thomas|Jefferson|1800 1804 > > 4|James|Madison|1808 1812 > > 32|Franklin|Roosevelt|1932 1936 1940 1944 > > > ----------OUTPUT---------------- > > D:\PerlLearn>perl array.plx > > 01 => HASH(0x248e5c) > > ^^ Thus I do not believe that this output is from the script above. > > hp You are correct. I had copied the script from a previous run and was playing with the order. The output is from a change in the DATA with the keys like 01. If you run the script, it produces 1,2, 3, 32, 4. CC.
First
|
Prev
|
Pages: 1 2 3 4 5 6 7 Prev: How to read a given number of lines? Next: something stupid |