title: Perl - how to avoid warnings about uninitialized elements of an array?
body: <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  
  sub paragraph
  {
  open my $file, "&lt;", "dict.txt" or die "$!";
  my @words = &lt;$file&gt;;
  close $file;
  
  print "Number of lines:";
  my $lines = &lt;&gt;;
  
  print "Max words per line:";
  my $range = &lt;&gt;;
  
  for(my $i = 0; $i&lt;$lines; $i++){
      my $wordcount = int(rand($range));
  
          for(my $s = 0; $s&lt;=$wordcount; $s++){
              my $range2 = scalar(@words);
              my $word = int(rand($range2));
              print $words[$word]." ";
  
                  if($s==$wordcount){
                      print "\n";}
                      }
                      }
                      }
  paragraph;
  </code></pre>
  
  <p>I'm trying to learn programming, so I just wrote this simple script.</p>
  
  <p>When running this code, I am getting use of uninitialized value errors... I can't figure out why, but I sure I am just overlooking something.</p>