CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Post deleted by cupofdoug



Mar 31, 2013, 6:47 PM

Post #1 of 2 (643 views)
Post deleted by cupofdoug


Veteran / Moderator

Apr 1, 2013, 2:07 AM

Post #2 of 2 (631 views)
Re: [cupofdoug] Perl newb seeking help with assignment [In reply to] Can't Post

Looking at the code you supplied in the attachment, you already know how to read one character at a time from the file. The instruction provided tell you to use the ord function to convert a character into its ASCII value. If your character is in the $chunk variable (as in your existing code), you just have to do something like this:

my $ascii = ord $chunk;

Similarly, your instructions tell you to use the sprintf function to convert the ASCII value into binary format. Just apply the recipe provided to you:

my $binary = sprintf ("%08b", $ascii);

Then you just have to print $binary to your output file.

I really do not see what is complicated for you in this assignment, which tells you how to do the things that are required.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives