A possible solution for the pairs.pl
program is as follows:
#!/usr/bin/perl # pairs.pl - save a list of numeric pairs to a file # # Write to the file "squares.dat" a list. Each line # will contain a number (i) and the square of that number. # The starting and ending number will be specified as user # input. use warnings; use strict; my $out_filename = 'squares.dat'; my ($start, $end); $start = <>; $end = <>; # check that $start <= $end unless ($start <= $end) { } # open $out_filename for writing # make a loop ($i) from $start to $end # write $i and $i*$i to the file foreach my $i ($start..$end) { } # close the file close OUT;