I would test the file before STDIN:
Note: mdillon is correct below: the ^ was added after his comment.open(DATA, "books.txt" or die "Could not open file: $!\n"; print "Letter: " and chomp (my $letter=<STDIN>); while(<DATA>) { print if /^$letter/io; }
In reply to RE: Trying to make a search
by turnstep
in thread Trying to make a search
by zdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |