$|++;
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~~";
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.
while (defined($filename = $term->readline('>'))) {
perlmonks.org content © perlmonks.org and Anonymous Monk, ikegami
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03