More specifically as to why it never stops, Perl treats not-numbers (such as your filenames) in a numeric context as having the numeric value 0. You're basically comparing two 0s then which are always equal. Had you used warnings you would have gotten a gripe Argument "bar" isn't numeric in numeric eq (==) at file.plx line 17. Had your filenames started with $rnumber as a prefix rather than having it as a suffix you would have gotten behavior more like you expect (since Perl would treat something like "44.spoo.bak" numerically as 44).
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re^2: Random number in while loop
by Fletch
in thread Random number in while loop
by marto9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |