are you trying to unmask my lack of Perl knowledge?
because I already stated I started learning perl few days ago.
BTW thanks for the answer but what I was wondering was if it is possible to print messages while the loop is running not when it finishes.
Because I coded a small script that runs for about 5 mins and It would be a nice detail to print the number of seconds until the process finishes
I think that is not possible thanks anyways.
I didn't mean to disparage your knowledge of perl and maybe I misunderstood your original question. What I thought you asked originally was "while the loop is running i want to print the numbers of times the loop has been repeated" and IMO mitchems answered that question. Now you ask how to print the number of seconds left before the process finishes. In my opinion that is a different question. Of course if you don't know in advance how much time a process is going to take then you probably cannot say how much longer the process will take while the process is running. But you would need to provide us with more information about the process before we can say whether what you want to do is possible. Why not start a new thread to ask it and mark this one solved?
If you use Time SoFar you can calculate this very easily:
use Time::SoFar qw( runtime runinterval figuretimes );
my $elapsed = runtime();
print "Start time $elapsed\n";
my $sincethen = runinterval(1);
print "Time since then $sincethen\n";