#!/usr/bin/perl use warnings; # always use this use strict; # always use this my $up_arrow = "\e[A"; # up arrow control character my @history = []; my $number = 10; while(1){ print "Enter a number...\n"; my $input = ; chomp $input; if ($input eq $up_arrow){ $input = $history[-1]; } push @history, $input; my $result = $number * $input; print "\nResult of $input x $number is: $result\n"; }