Just eliminate some write space. Use some variables. Use the -l flag.
You could use a variable and / and * but
rounding differences will creep in.
Five newlines may be removed from the following.

I don't do this kind of thing much and tend
not to recommend it to beginners. That is my bias.

I think there are two paths to Perlish wisdom ,
on one you will, if necessary, flip hamburgers for minimum
wage to buy disk space and random access memory
to avoid having to scrunch beauteous code into small
spaces.
The short path is to sit in front of the keyboard
and learn all the weirdities of perl.
The short path is only shorter in that you sit in
one place a lot.

Perhaps if you can come and go at the same time. And
hear the difference between a symbol table alias
and hard ref. Then you should take both paths.

The nature of the enlightenment achieved varies depending
upon which path you take.

#!/usr/bin/perl -l print"Enter the distance to be converted:"; $_=<>; chomp; $k=" kilometers"; $m=" miles"; print"$_$k= ".$_*0.6214."$m\n$_$m= ".$_*1.609."$k";

In reply to Re: making a shorter code! by rir
in thread making a shorter code! by husoft

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.