in reply to acessing the contents of a file character by character

gvs_jagan,
Like others, it seems odd to me that you would want to read character by character if you are trying to match a pattern than spans multiple characters. With that said, it can certainly be done. If the pattern match is always fixed width, you can use a sliding buffer window. The buffer fills up to the width of the pattern you are looking for and when you add a new character the oldest one falls off. To see how to read character by character:
{ local $/ = \1; while ( <FILE> ) { my $window = adjust_window( $_ ); next if $window ne $search; # .... what to do if you find the match } }

Cheers - L~R