in reply to split to hash, problem with random keys

When you define the keys, simply create an array with the keys ordered in the way you like.

my @iRecord_keys = qw( foo bar baz ); # . . . @iRecord{ @iRecord_keys } = split /\|/, $line;
-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: split to hash, problem with random keys
by december (Pilgrim) on Jul 03, 2003 at 17:09 UTC

    I've been thinking about this too - it's what I do now. Seems a bit stupid to duplicate the keys once again, but if it's the only way to ensure the correct order...

    Thanks!