Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<STDIN> to Hexadecimal 1

Status
Not open for further replies.

Cannabishop

Programmer
Jan 28, 2006
3
CA
For the life of me I cannot figure out how to change my input from decimal to hexadecimal. Can anyone (although, it will probably be everyone) help me with the code for this?
My exisiting code is below:

#!/usr/bin/perl
use strict;
use warnings;

my @line;
my $x;
my $sum=0;
my $num;

print "Please enter 10 numbers, one per line\n";

for ($x=0; $x<10;$x++)
{
$line[$x] = <STDIN>;
}

chomp @line;

print "\t\t\tReport for Glen Lederman\n\n";
print "\tAll the Values : \t\t@line\n";
print "\tSame Values Backwards :\t\t".reverse("@line")."\n";
$sum += $_ for @line;
print "\tSum of the Values: \t\t$sum\n";
print "\tThe Values in Hexadecimal:\t\t\n";

What is so simple that I am missing it completely??
 
Take a look at thread219-1183314 for a couple of ways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top