I'm working on a fairly lengthy ( for a newbie like me) program that has two modes.  
The user can type "mine blah" and my program will find all "blah" or he/she can type 
"mine !" to enter interactive mode.  The problem is that when I get to this snippet:

sub getinteractivesearch
{
         #print "We're interactive!\n\n";
         opendir(logdirectory, '.') or die "Can't open directory.";
         print "Enter string to search for: ";
         $searchstring = <>;
         chomp $searchstring;
         print $searchstring;
         &searchfiles; 
}

My program dies with this:

Enter string to search for: Can't open !: No such file or directory at 
C:\PERLPR~1/mine.bat line 46.

So basically it looks like it's skipping the part where is asks for the search string. 
 I have had this problem before, and I have never been able to figure it out.  Is 
there some way to flush the <>?  Or what?  I'm totally in the dark here.  Maybe I'm 
looking in a completely wrong direction.  Can someone be my guide?  If you need more 
code I'd be happy to provide it.  My problem might not even exist in this snippet.

-Dave

Reply via email to