... the following code ... does not produce your expected output. Perhaps we misunderstand your requirement.
I'm also confused about Sidd@786's expected output. I can see that 'he is man' from file1 should be output because it has 'he is' from file2 as an exact substring. But Sidd@786 also seems to be saying in the OP that 'what goes on' should also be output, and I don't see how that's possible given the (somewhat vaguely presented) data and my (similarly vague) understanding of the requirement. Perhaps Sidd@786 can clarify things for us.
I have code solutions for both index-based and dynamic regex approaches, but I'm a bit reluctant to post because the OP has too strong a smell of homework about it. Perhaps I'll post them tomorrow.
Give a man a fish: <%-{-{-{-<
In reply to Re^2: partial matching of lines in perl
by AnomalousMonk
in thread partial matching of lines in perl
by Sidd@786
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |