Thread arrays vergleichen
(23 answers)
Opened by blaise4714 at 2007-04-24 16:21
Okay, da es im IRC noch Unklarheiten gab...
Vodoo.pm test1.pl Code: (dl
)
1 use strict; #> ./test1.pl 7 - w kommt an Stelle 7 im 2. Array vor. 5 - a kommt an Stelle 5 im 2. Array vor. 8 - f kommt an Stelle 8 im 2. Array vor. 10 - g kommt an Stelle 10 im 2. Array vor. 9 - b kommt an Stelle 9 im 2. Array vor. 10 - g kommt an Stelle 10 im 2. Array vor. 2 - r kommt an Stelle 2 im 2. Array vor. 6 - l kommt an Stelle 6 im 2. Array vor. Das schaut also soweit ok aus, da $[ mit 0 kompiliert wird. Wenn aber "use Vodoo;" nach "$[ = 0" eingebunden wird, passiert folgendes: test2.pl Code: (dl
)
1 use strict; #> test2.pl Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. 16 - w kommt an Stelle 16 im 2. Array vor. 27 - w kommt an Stelle 27 im 2. Array vor. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Use of uninitialized value in string eq at ./test.pl line 15. Und so weiter und so weiter... Hier wurde in Vodoo.pm $[ auf 20 gesetzt und die for-Schleife beginnt fix mit 0. Wie verhält man sich also, wenn irgendjemand in einem Modul $[ verändert? Sollte man dann lieber die Laufvariable mit $[ initialisieren oder auf das Modul verzichten? Gruss, opi\n\n <!--EDIT|opi|1177491469--> 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. |