#!/usr/bin/perl use warnings; use strict; print "please enter two odd numbers \n"; print "enter first odd number: "; my $odd1 = ; chomp ($odd1); print "enter second odd number: "; my $odd2 = ; chomp ($odd2); if ($odd1 % 2 == 0 || $odd2 % 2 == 0) { exit; } my @odds; my $step = 2; if ($odd1 >= $odd2) { $step *= -1; } my $i; for ($i = $odd1; $i <= $odd2;$i += $step) { push(@odds, $i); } print "numbers:"; foreach $i (@odds) { print "$i "; } print "\n";