in reply to Trying to make a search

the value of $letter has a line ending on the end. try this:
print "Letter? "; my $input = <STDIN>; # get rid of line ending chomp($input); # take the first character and escape it if it is a possible metachara +cter my $letter = quotemeta substr $input, 0, 1; open DATA, 'books.txt' or die "Couldn't open books.txt: $!"; my @data = <DATA>; close DATA; foreach my $data (@data) { print $data if $data =~ /^$letter/i; }