Thanks a lot for the prompt reply. Here suppose say that the first file has one more line
print ("$hour\:$min\:$sec");
then it will print the current time (eg 16:4:50) on the screen when ran. But I want the same thing to be printed by the second program when it calls the first program and stores it in $results.
I am very new to perl so all the mistakes. Thanks for correcting all those.