in reply to How to findout a sub string from the string

You need to say more on how to determine what you want to extract.

Assuming you want to extract the last line of the string (i.e. everything after the last \n), you could use split and retrieve the last field:

my $substring = (split /\n/, $tmp)[-1];
Or use a regular expression:
my ($substring) = $tmp =~ /\n(.*)$/;