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; }
In reply to Re: Trying to make a search
by mdillon
in thread Trying to make a search
by zdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |