Hi all, I'm new to programming and have started on a "Beginning Perl" tutorial. I'm having a few problems and am hoping someone here can shed some light :) One of the first exercises was to write a program for a basic currency converter, here's what I did -
#!/usr/bin/perl -w #currency2.plx use warnings; use strict; print "Currency converter\n\nPlease enter the exchange rate: "; my $yen = <STDIN>; print "Now please enter a price to convert\n"; print "Price:"; my $price = <STDIN>; print "$price Yen is ", ($price/$yen), "pounds\n";
The problem is that when it prints the answer (line 10) it splits it over two lines, with the amount $price on the first line and rest - Yen is... - on the next. Why is this? At this stage I'm just using Windows notepad and running the program in the command prompt as I haven't gotten as far as using a proper text editor yet.

In reply to Output split over two lines by thevoid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.