Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing a program for fun to make Cramer's Rule easy to do, just by typing in some numbers. I put in this code for part of the script: print "| $a1 $a2 $a3 | $a1 $a2\n"; print "| $b1 $b2 $b3 | $b1 $b2\n"; print "| $c1 $c2 $c3 | $c1 $c2\n"; And it comes out in the actual program looking like this: | 1 2 3 | 1 2 | 5 6 7 | 5 6 | 9 1 2 | 9 1 The way I want the numbers to be set up is: | 1 2 3 | 1 2 | 5 6 7 | 5 6 | 9 1 2 | 1 2 Any suggestions on how I would make this work this way?

Replies are listed 'Best First'.
Re: print problem
by c-era (Curate) on Jun 07, 2000 at 04:08 UTC
    try
    print "| $a1 $a2 $a3 | $a1 $a2\n"; print "| $b1 $b2 $b3 | $b1 $b2\n"; +print "| $c1 $c2 $c3 | $c2 $c3\n"
Re: print problem
by btrott (Parson) on Jun 07, 2000 at 04:09 UTC
    Apparently all your variables have carriage returns on the end of them. chomp them.