programming-examples/perl/String/chop function deletes the character at the right end of the line of text.pl
2019-11-15 12:59:38 +01:00

11 lines
338 B
Perl

#!/usr/local/bin/perl
print ("Enter the distance to be converted:\n");
$originaldist = <STDIN>;
chop ($originaldist);
$miles = $originaldist * 0.6214;
$kilometers = $originaldist * 1.609;
print ($originaldist, " kilometers = ", $miles," miles\n");
print ($originaldist, " miles = ", $kilometers, " kilometers\n");