4 ms·
Some people don't like sigils on variable names, and I get that. Personally I find them useful. As far as the perldsc page example, I think that comes down to
by nocman 5y ago
Some people don't like sigils on variable names, and I get that. Personally I find them useful.
As far as the perldsc page example, I think that comes down to having a better personal style that makes your code readable. I would make the top level variable a hash reference rather than a plain hash, and purposefully not insist on dereferencing multiple levels all on one line.
As someone pointed out in another comment, you can make the Python version look just as lousy by virtue of a lousy style.
My version of code doing the same task would be something like this:
my $familyData = $TV->{$family};
my $lead = $familyData->{lead};
my $kidsList = $familyData->{kids};
my $kidCount = scalar( @{ $kidsList } );
my $kidListStr = join (
", ",
map { $_->{name} } @{ $kidsList }
);
print "it turns out that $lead has ";
print "$kidCount kids named $kidListStr\n";
- deleted 5y ago[deleted]