negzero7 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to get perl to read in a bunch of info from the user and format it, to print it out on screen like this:
+--------------------------------------------------------------+ | Check No. $chkno | | $first $last | | $addr[0] | | $addr[1] | | $phone $date | | | | Pay to the | | Order of: $payee $amount | | | | For: $memo Stamped Signature | | | +--------------------------------------------------------------+
I keep running into errors and I am not sure what's wrong. The address is supposed to be stored in an @array[0] and @array1 (first for house number and street, second for city, state, zip).
Take a look at my code and see if you can help me out.
#!/usr/bin/env perl use warnings; use strict; print "Please enter the check number: "; chomp (my $chkno = <STDIN>); print "Please enter your first and last name: "; chomp (my $first = <STDIN>); chomp (my $last = <STDIN>); print "Please enter your house number (or PO box) and street name: "; chomp (my $one =<STDIN>); print "Please enter your city, state, and zipcode: "; chomp (my $two = <STDIN>); my @addr = {$one, $two}; print "Please enter your phone number: "; chomp (my $phone = (<STDIN>)); print "Please enter the date: "; chomp (my $date = <STDIN>); print "Please enter the payee's name: "; chomp (my $payee = <STDIN>); print "Please enter the amount to be paid: "; chomp (my $amount = <STDIN>); print "Please enter a memo for the check: "; chomp (my $memo = <STDIN>); format CHECK = +--------------------------------------------------------------+ | Check No. @##### | $chkno, | @<<<<<<<<< @||||||||||||||| | $first, $last, | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | $addr[0], | @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | $addr[1], | @<<<<<<<<<< @|||||||||||||||||| | $phone, $date, | | | Pay to the | | Order of: @|||||||||||||||||||||||||||| @#####.## | $payee, $amount, | | | For: @<<<<<<<<<<<<<<< Stamped Signature | $memo | | +--------------------------------------------------------------+ . write (CHECK);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Formatting and write help
by ikegami (Patriarch) on Apr 15, 2008 at 01:43 UTC | |
Re: Formatting and write help
by ysth (Canon) on Apr 15, 2008 at 02:26 UTC | |
by negzero7 (Sexton) on Apr 15, 2008 at 03:40 UTC | |
Re: Formatting and write help
by moklevat (Priest) on Apr 15, 2008 at 01:47 UTC | |
Re: Formatting and write help
by amarquis (Curate) on Apr 15, 2008 at 01:45 UTC | |
by negzero7 (Sexton) on Apr 15, 2008 at 02:21 UTC |
Back to
Seekers of Perl Wisdom