Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This works fine except when I just press enter at the '>' prompt; at which point the program exits, without even getting to "checking for...". The same thing happens in the middle of my program. Obviously, I don't want this, as I then end up trying to open a file that isn't there. Is this behaviour intentional? Any ideas appreciated.$|++; use Term::ReadLine; my $term = new Term::ReadLine 'test'; while ($filename = $term->readline('>')) { print "checking for $filename...\n"; last if (-e $filename); print "file not found, try again\n"; } print "filename is ~~$filename~~";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Term::ReadLine behaviour on a blank line
by ikegami (Patriarch) on Apr 03, 2006 at 16:15 UTC | |
by Anonymous Monk on Apr 03, 2006 at 16:41 UTC | |
|
Re: Term::ReadLine behaviour on a blank line
by Anonymous Monk on Apr 03, 2006 at 16:21 UTC |