in reply to Re: recursive difficulty
in thread recursive difficulty
I copied and pasted the code from perlmonks onto a different computer; that may be related.
I thought perhaps my vim expandtabs option on this machine was involved, but I retyped the DATA using ^V. This code
prints the entire table row as the value of $child, and no value for $par. For example:# key: parent # val: list of immediate children sub load_hashes{ my ($child, $par); while(<DATA>){ chomp; ($child, $par) = split /"\t"/; #push @{$immed_child{$par}}, $child; print "ch: $child, par: $par\n"; } }
ch: jumprope exercise_device, par:
this explains the unitialized value in the string. Is there an obvious mistake in my split that has somehow occurred in the copying of the code from perlmonks onto a new machine?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: 2: recursive difficulty
by pg (Canon) on Mar 10, 2003 at 00:05 UTC | |
by jjohhn (Scribe) on Mar 10, 2003 at 00:32 UTC | |
by theorbtwo (Prior) on Mar 10, 2003 at 02:59 UTC | |
by Hofmator (Curate) on Mar 10, 2003 at 09:25 UTC |