http://qs1969.pair.com?node_id=796806


in reply to DBD::mysql trouble

I would use Term::Interact like so
#!/usr/bin/perl -- use strict; use warnings; use Data::Dumper; use Term::Interact; print Dumper( prompt_customer() ); sub prompt_customer { my %customer; my $ti = Term::Interact->new; $customer{firstname} = $ti->get( msg => "\nComputer Information\n-----------------------\n", prompt => "Customer First Name: ", check => [ qr/^\w+$/, ], ); $customer{lastname} = $ti->get( msg => "", prompt => "Customer Last Name: ", check => [ qr/^\w+$/, ], ); $customer{phone} = $ti->get( msg => "", prompt => "Customer Phone #: ", check => [ qr/^[\d\s\-\,]+$/, ], ); $customer{email} = $ti->get( msg => "", prompt => "Customer Email: ", check => [ qr/^\S+$/, ], ); $customer{compman} = $ti->get( msg => "\nComputer Information\n-----------------------\n", prompt => "Computer Manufacturer: ", ); $customer{compmodel} = $ti->get( msg => "", prompt => "Computer Model: ", ); $customer{compModelNum} = $ti->get( msg => "", prompt => "Computer Model #: ", ); $customer{errormsg} = $ti->get( msg => "", prompt => "Error Message (if any): ", ); $customer{os} = $ti->get( msg => "", prompt => "Operating System: ", ); $customer{probdesc} = $ti->get( msg => "", prompt => "Problem Description: ", ); $customer{loginpw} = $ti->get( ReadMode => 2, msg => "", prompt => "Administrator/Root Login Password: ", ); $customer{service} = $ti->get( msg => "", prompt => "Computer Service Needed: ", ); $customer{barcode} = $ti->get( msg => "", prompt => "Barcode Number: ", ); $customer{date} = scalar localtime; print "\n"; return \%customer; } __END__ ### for testing, COPY/PASTE when prompted first last 444 444 444 asdf@email.com manu mode 33 err os prob rootpass compserv barcode ## sample session Computer Information ----------------------- Customer First Name: first Customer Last Name: last Customer Phone #: 444 444 444 Customer Email: asdf@email.com Computer Information ----------------------- Computer Manufacturer: manu Computer Model: mode Computer Model #: 33 Error Message (if any): err Operating System: os Problem Description: prob Administrator/Root Login Password: Computer Service Needed: compserv Barcode Number: barcode $VAR1 = { 'probdesc' => 'prob', 'firstname' => 'first', 'date' => 'Tue Sep 22 12:44:24 2009', 'barcode' => 'barcode', 'lastname' => 'last', 'service' => 'compserv', 'phone' => '444 444 444', 'os' => 'os', 'email' => 'asdf@email.com', 'loginpw' => 'rootpass', 'errormsg' => 'err', 'compModelNum' => '33', 'compman' => 'manu', 'compmodel' => 'mode' };