in reply to Using a regex pattern from STDIN
Could it be that when you read from <STDIN> you are getting an automatic newline character that is affecting your search? Try chomp. qr may be of interest to you as well.