On Mar 30, 2009, at 9:29 AM, Chas. Owens wrote:
#!/usr/bin/perl
use strict;
use warnings;
use Term::ReadLine;
my $term = Term::ReadLine->new($0);
Thanks - it does exactly what I wanted.
I've looked at the perldoc for Term::ReadLine and it's a little thin -
mainly because it describes itself as being only a front-end to a
variety of other packages.
my @fields = qw/state city zip/;
my %rec;
while (1) {
my $coded = $term->readline("Enter coded location");
last if @r...@fields} = $coded =~ /^([A-Z]{2})-(\w+)([0-9]{5})$/;
print "please try again\n";
}
(my $prompt = $rec{city}) =~ s/(?<!^)([A-Z])/ $1/g;
$prompt .= ", $rec{state} $rec{zip}";
What is the above substitution doing?
Thanks again - this is wonderful.
Chap Harrison
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/