in reply to Enter Filename

You can use code from answers to your previous question and add a little check for the variable containing the value of -s parameter, something like this:
defined $statfile && open my $FILE, ">", 'last_5min.stat' or die $!; <...> defined $statfile && print $FILE "<ED>$by</ED>\n<ECO>Max Busy</ECO>\n< +ECE></ECE>";
Sorry if my advice was wrong.