title: Sleep function not working inside for loop using Perl Script
body: <p>My code is:</p>
  
  <pre><code>#!/usr/local/bin/perl 
  use Time::Piece;
  use Time::HiRes;
  use strict;
  use warnings 'all';
  my $i = 1;
  my $starttime = localtime-&gt;strftime('%Y%m%d%H%M');
  open my  $file, '&gt;', 'order.properties' or die $!;
  for ($i = 1; $i &lt;= 10; $i++){   
    print $file "Start_time_$i = $starttime\n";
    sleep (120);
  }
  close $file;
  </code></pre>
  
  <p>In the above code I am creating an <code>order.properties</code> file and writing a variable called <code>Starttime</code> and assigning date and time in a format of <code>YYYYMMDDHH24MM</code> and iterating the variable for 10 time with sleep time 2 mins, but sleep is not working and after adding sleep function to the Script, it's just creating a file not writing anything into it.</p>
  
  <p>For each iteration of for loop I need 2 mins of sleep like: </p>
  
  <pre><code> Start_time_1 = 201812141350
   Start_time_2 = 201812141352
  </code></pre>
  
  <p>The output should be like above.</p>