#!/usr/bin/perl use warnings; use strict; my $input; print("Your number: "), chomp( $input = ) until $input =~ /^\d+$/; print 3 * $input - 1, $/;