tc1364 has asked for the wisdom of the Perl Monks concerning the following question:
sub_info(\%ca, \@ca); sub_info(\%nv, \@nv); @keys = (); @keys = sort { $a cmp $b } (keys %ca); foreach $key (@keys) { $val = $ca{$key}; print "$key $val\n"; } @keys = (); @keys = sort { $a cmp $b } (keys %nv); foreach $key (@keys) { $val = $nv{$key}; print "$key $val\n"; } exit 0; sub upd_info () { $params1 = shift; %paramhash = %$params1; $params2 = shift; @paramarray = @$params2; while (($key, $val) = each(%paramhash)) { $upd_flg = 0; foreach $item (sort { $a cmp $b } @paramarray) { if ($item =~ /^$key\s+(\w+)$/) { $upd_flg = $upd_flg + 1; $paramhash{$key} .= " $1"; last; } } if ($upd_flg == 0) { $paramhash{$key} .= " NONE"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sub routine trouble
by ccn (Vicar) on Dec 10, 2004 at 18:31 UTC | |
|
Re: sub routine trouble
by ikegami (Patriarch) on Dec 10, 2004 at 18:32 UTC | |
by tc1364 (Beadle) on Dec 10, 2004 at 19:14 UTC | |
|
Re: sub routine trouble
by Zaxo (Archbishop) on Dec 10, 2004 at 18:51 UTC | |
|
Re: sub routine trouble
by osunderdog (Deacon) on Dec 10, 2004 at 19:56 UTC | |
|
Re: sub routine trouble
by Eimi Metamorphoumai (Deacon) on Dec 10, 2004 at 18:45 UTC |