Do you know where your variables are? | |
PerlMonks |
possible wierdness from "for @array"by hsinclai (Deacon) |
on Mar 31, 2009 at 16:45 UTC ( [id://754462]=perlquestion: print w/replies, xml ) | Need Help?? |
hsinclai has asked for the wisdom of the Perl Monks concerning the following question: Hi Monks, I'm seeing wierd behavior in this snippet - and can't understand why.. Whatever number of elements @range contains, $#blah always contains half that number, minus 1. Replacing the qx!cat .. ! with open and getting the file contents into an array doesn't change the behavior... Replacing the "int rand" with a plain number, or POSIX floor/ceil doesn't change the behavior.. Using a more standard seems to have no effect either.. Can anyone see why this happens? (my /etc/services file has 9252 lines, same effect with other files) Is it a bad idea to put code in between the brackets of $array[indices] ? Many thanks for your insight!
Back to
Seekers of Perl Wisdom
|
|