title: how to solve Useless use of private variable in void context, Use of uninitialized value $interval in division (/) and Illegal division by zero at
body: <p>I don't have any experience in working with Perl, and so I m not able to solve this issues. Can you please help me out on solving this : </p>
  
  <pre><code>Error 1 : Useless use of private variable in void context at ./createnodelist.pl line 51.
  Error 2 : Use of uninitialized value $interval in division (/) at ./createnodelist.pl line 10.
  Error 3 : Illegal division by zero at ./createnodelist.pl line 10.
  </code></pre>
  
  <p>Basically the below script  should load the list of certificates and produces a list of nodes which minutes assigned to a node : </p>
  
  <pre><code>line 51    print FILE "\n";
  
  line 10   my $jph = ceil(60/$interval);
  </code></pre>
  
  <p>Source code:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use warnings;
  use strict;
  
  use POSIX;
  
  my $interval = $ARGV[0];
  my $path     = '/etc/puppet/modules/puppet/scripts/puppet_cron';
  
  # Calculate how many jobs per hour we have
  my $jph = ceil( 60 / $interval );
  
  # Load list of all nodes
  my @nodes = `/usr/sbin / puppetca -la | /usr/ bin / cut -d ' ' -f 2`;    #
  chomp(@nodes);
  
  # Count number of nodes
  my $node_count = scalar(@nodes);
  
  # Count number of nodes per group
  my $nodes_per_group = $node_count / $interval;
  
  # Process nodes list and assigne minutes for each node
  open( FILE, "&gt;$path/nodes.list" );
  for ( my $i = 0; $i &lt; $interval; $i++ ) {
      my $minute;
      my $group = $i + 1;
      my $node_n;
  
      # Process nodes in group
      for ( $node_n = 0; $node_n &lt; $nodes_per_group; $node_n ) {
  
          # Assign minutes to a node
          my $node = shift(@nodes);
          if ($node) {
              print FILE "$node;";
              for ( my $n = 0; $n &lt; $jph; $n++ ) {
                  $minute = $i + ( $interval * $n );
                  if ( $minute
                      &lt; 60 )    # Only print minutes that actually exist
                  {
                      print FILE "$minute";
                  }
                  if ( $n != $jph - 1 ) {
                      print FILE ',';
                  }
              }
          }
          $node_n++;
          print FILE "\n";
      }
  }
  close(FILE);
  exit 0;
  </code></pre>