[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Perl and Celsius Symbo

Posted on 2011-02-18
6
Medium Priority
?
476 Views
Last Modified: 2012-06-21
Hiya

Can anybody tell me how to print to the console the Celsius symbol?

John
0
Comment
Question by:IssacJones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 5

Expert Comment

by:group0
ID: 34928244
print "\xB0";
0
 

Author Comment

by:IssacJones
ID: 34945276
Hi group0

That does not work for me. I simply get a character that looks like a hatched rectangle. I am using Windows 7.

John
0
 
LVL 5

Expert Comment

by:group0
ID: 34946336
Apparently extended ascii and unicode character set issues are fairly common on Windows.

Can you try running the following:
use utf8;
print "1: \x{00B0}\n";
print "2: " . chr(0x00B0) . "\n";
print "3: \x{00F8}\n";
print "4: " . chr(0x00F8) . "\n";

Open in new window


You can also try entering ALT-0176 or ALT-248 and see if either outputs the proper symbol when editing the source.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:IssacJones
ID: 34946370
hi group0

3 and 4 work!!!!

I take it that there is some connection between 0176/248 and 00B0 and 00F8. What is the connection and how to I convert between the two?

John
0
 

Author Comment

by:IssacJones
ID: 34946482
Is there a way I can write the Perl code so it uses numbers like 248 (which I recognise) instead of the hex equivalent?

John
0
 
LVL 5

Accepted Solution

by:
group0 earned 1000 total points
ID: 34946609
Yes, 176 in hex is B0 and 248 is F8.  To use the decimal version, use chr() without a leading 0x:

print chr(248) . "\n";

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question