tc1364 has asked for the wisdom of the Perl Monks concerning the following question:
sub xls () { my ($hashref) = @_; my @keys = sort { $a cmp $b } (keys %{$hashref}); for my $key (keys %{$hashref}) { my $val = $hashref->{$key}; my ($a, $b, $c, $d, $e) = split(/\s+/, $val, 5); $worksheet->write($y, 0, $a, $field_data); $worksheet->write($y, 1, $key, $field_data); $worksheet->write($y, 2, $b, $field_data); $worksheet->write($y, 3, $c, $field_data); $worksheet->write($y, 4, $d, $field_data); $worksheet->write($y, 5, $e, $field_data); $y++; } $y++; }
Retitled by davido from "Syntax error", per consideration to improve searchability.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Syntax error sorting hash keys
by Velaki (Chaplain) on Dec 13, 2004 at 17:23 UTC | |
by tc1364 (Beadle) on Dec 13, 2004 at 17:39 UTC | |
|
Re: Syntax error sorting hash keys
by si_lence (Deacon) on Dec 13, 2004 at 17:40 UTC | |
by revdiablo (Prior) on Dec 13, 2004 at 19:25 UTC | |
|
Re: Syntax error sorting hash keys
by ysth (Canon) on Dec 13, 2004 at 20:26 UTC |