open INPUT, "< $filename" or die "Cannot open $filename for input: $!"; @text = ; close (INPUT); $text = "@text"; @splittext = split(/$string/,$text); #To extract concordance lines from text for (my $i=1; $i < @splittext; $i++) { my $before = substr((' 'x10).$splittext[$i-1],-20,20); my $after = substr($splittext[$i].' 'x10,0,20); print p($before, strong($string), $after,"\n"), }