#!/usr/local/bin/perl use warnings; use strict; use Text::Autoformat 'autoformat'; my $horrid = <<'_INPUT_'; Thnks 4 ur reply. bt u didn't reply 4 my whole question. as i also asked if i search for 47 . then it is giving me index 7 . and at 7 index 37 is given . so its giving me 37 . bt it should give me that this key is not available. means how colud i compare my whole keys with key 47. so i can say it is not avaialbe and one thing more if i searched for 201 then there are two keys there then how it will give 201. _INPUT_ for ( $horrid ) { s/\b i \b/I/gxms; s/\b bt \b/but/gxms; s/\b 4 \b/for/gxms; s/\b u \b/you/gxms; s/\b ur \b/your/gxms; s/[ ]([.?!])/$1/gms; } print autoformat( $horrid , { 'squeeze' => 1 , 'justify' => 'left' , 'case' => 'sentence' , 'left' => 0 , 'right' => 78 } ); __END__ Thnks for your reply. But you didn't reply for my whole question. As I also asked if I search for 47. then it is giving me index 7. and at 7 index 37 is given. So its giving me 37. but it should give me that this key is not available. Means how colud I compare my whole keys with key 47. so I can say it is not avaialbe and one thing more if I searched for 201 then there are two keys there then how it will give 201.