by nferraz@[EMAIL PROTECTED]
(Nelson Ferraz)
Jul 26, 2004 at 05:47 PM
Gregoire Hostettler wrote:
> Seriousely considering making my customer change his mind and revert to
> plain old C++
(...)
> Looks like Perl is not able to handle trivial data structure like an
array
> of records (or hashes).
Gregoire,
1) Your code *shows* you're a C/C++ programmer; it will take some time
to be proficient in Perl, if you want to.
2) The comment at line 29 is impolite and unnecessary.
3) It's easy to add a new item to an array of hashes (you must fix it in
line 60):
push @[EMAIL PROTECTED]
\%hash;
4) Use Data::Dumper to check your data structure:
use Data::Dumper;
print Dumper @[EMAIL PROTECTED]
) It's easier to iterate over an array of hashes using foreach:
foreach my $hashref (@[EMAIL PROTECTED]
) {
# do something with $hashref or %{$hashref}
}
[]s
Nelson