my $number; open FILE, "<", "/path/to/your/file" or die; while ($number = ) { # read in a line of the file chomp $number; # remove the newline # do something with each number } close FILE;