CTRL-Z (end of file) does not break you out of your infinite loop ... so what construct would? Maybe checking if $var has a value? Maybe moving that check into your while so you do not have an infinite loop:
There are many ways. Your problem has nothing to do with arrays but with how to write effective control structures. *And* there are more idiomatic ways of figuring out if a value is in an array. Iterating through the array is going to be costly at some point -- you might be better off using a hash to track what's been placed in the array (and ... this really looks like a homework problem).while( $val = <> )
In reply to Re^3: question on Arrays
by derby
in thread question on Arrays
by hari9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |