Hello bbb,
The variable $word is lexically scoped, meaning its scope extends only to the end of the block in which it is declared. Since you declare it in an if block which is itself within a while block, it is out of scope by the time you try to print it.
You need to declare $word before the while loop.1 If you had use strict; at the head of your script, it would highlight this kind of error for you.
1Update: Or move the print statement to within the if block.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Use of uninitialized value in regexp
by Athanasius
in thread Use of uninitialized value in regexp
by bbb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |