Thread Array Prüfung
(4 answers)
Opened by jan10001 at 2003-10-13 18:59
[quote=DS,13.10.2003, 18:15]Ich hab noch nie getestet, was passiert, wenn man einen Array mit defined testet, also hab' ich das mal nachgeholt...[/quote]
aus perldoc -f defined: Use of "defined" on aggregates (hashes and arrays) is deprecated. It used to report whether memory for that aggregate has ever been allocated. This behavior may disappear in future versions of Perl. You should instead use a simple test for size: if (@an_array) { print "has array elements\n" } if (%a_hash) { print "has hash members\n" } 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"
lesen: Wie frage ich & perlintro brian's Leitfaden für jedes Perl-Problem |