I am trying to make a program that converts decimal numbers or text into binary numbers in perl. The program asks for user input of a character or string , and then prints out the result to the console. How do I do this? My code I have been working on is below, but i cannot seem to fix it.
print "Enter a number to convert: ";
chomp($decimal = <STDIN>);
print "\nConverting $number to binary...\n";
$remainder = $decimal%2;
while($decimal > 0)
{
$decimal/2;
print $remainder;
}