Re: Serious question on using Perl or not...

[email protected] (Nelson Ferraz)
Newsgroups perl.advocacy
Message-ID <[email protected]>
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 @array, \%hash;

4) Use Data::Dumper to check your data structure:

	use Data::Dumper;
	print Dumper @table;

5) It's easier to iterate over an array of hashes using foreach:

	foreach my $hashref (@table) {
	  # do something with $hashref or %{$hashref}
	}

[]s

Nelson
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.