ist es möglich, die Anzahl der Schlüssel in einem hash direkt zu bestimmen, also ohne eine Schleife?
Danke.
D'OH
Daniel
bloonix
2007-06-29 17:18
User since 2005-12-17
1615
Artikel HausmeisterIn
keys
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.
renee
2007-06-29 17:23
User since 2003-08-04
14371
Artikel ModeratorIn
<!--pod_f1--><a href="//perldoc.perl.org/functions/keys.html" target="_blank"><img alt="perldoc " src="/iB_html/non-cgi/Skin/SKIN-3/images/perldoc.gif" border="0"> <!--pod_f2-->Und der Link zur Doku<!--pod_f3--></a><!--pod_f4--> ;)
my @keys = keys %hash; my $length=$#keys+1-$[; print "$length\n";
[/quote]
kleiner scherz, oder?
merke:
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"