in reply to Read two values from input
use strict; use warnings; my $inp = getInput('Enter two values'); $inp = [split /[\s,]+/, $inp]; print "Values entered are: $inp->[0], $inp->[1]\n"; sub getInput { my $inp; while (1) { print "$_[0]: "; chomp($inp = <STDIN>); return $inp if $inp; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Read two values from input
by ww (Archbishop) on Nov 27, 2011 at 16:26 UTC | |
by TJPride (Pilgrim) on Nov 28, 2011 at 05:24 UTC |