A while loop is often used to read from a file until there is no more data available.
#!/usr/local/bin/perl # Set the value of x $x=1; while ($x <= 10) { print $x++ . ", "; } print "\n";