in reply to pattern string match while reading from the file
If you want to pick a line based on the number, you should extract that number from the line and then do a numerical comparison:
$line=~/^(\d+):/; if( $1==$input ){ ... [download]