<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Octal, Hexadecimal, And Decimal Conversion</title>
	<atom:link href="http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/</link>
	<description></description>
	<lastBuildDate>Thu, 23 Oct 2008 23:15:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: William Ward</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-41732</link>
		<dc:creator>William Ward</dc:creator>
		<pubDate>Tue, 08 Jul 2008 19:47:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-41732</guid>
		<description>I think (s)printf is probably a lot more readable than using pack and unpack, though I suspect yours may be faster.</description>
		<content:encoded><![CDATA[<p>I think (s)printf is probably a lot more readable than using pack and unpack, though I suspect yours may be faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: makjander</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-41729</link>
		<dc:creator>makjander</dc:creator>
		<pubDate>Tue, 08 Jul 2008 17:42:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-41729</guid>
		<description>oops... hehe... i&#039;ve run it now and see what you say it outputs, i&#039;ve didn&#039;t tested before
but you can change it using a workaround:

$number=5;
print unpack &quot;B8&quot;, (pack &quot;J&quot;, $number);</description>
		<content:encoded><![CDATA[<p>oops&#8230; hehe&#8230; i&#8217;ve run it now and see what you say it outputs, i&#8217;ve didn&#8217;t tested before<br />
but you can change it using a workaround:</p>
<p>$number=5;<br />
print unpack &#8220;B8&#8243;, (pack &#8220;J&#8221;, $number);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Ward</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-41724</link>
		<dc:creator>William Ward</dc:creator>
		<pubDate>Tue, 08 Jul 2008 16:28:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-41724</guid>
		<description>That doesn&#039;t work the way you say.  Did you run it?

When I run your program I get &quot;00110101&quot; instead.  Pack and unpack work on character strings, so 5 is really the string &quot;5&quot; and 00110101 is the ASCII code for the &quot;5&quot; character.</description>
		<content:encoded><![CDATA[<p>That doesn&#8217;t work the way you say.  Did you run it?</p>
<p>When I run your program I get &#8220;00110101&#8243; instead.  Pack and unpack work on character strings, so 5 is really the string &#8220;5&#8243; and 00110101 is the ASCII code for the &#8220;5&#8243; character.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: makjander</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-41706</link>
		<dc:creator>makjander</dc:creator>
		<pubDate>Tue, 08 Jul 2008 07:45:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-41706</guid>
		<description>to convert a decimal number into binary it&#039;s just even more easy: use UNPACK!!

for example:

$number=5;
print unpack &quot;B8&quot;, $number;   

will output:
00000101</description>
		<content:encoded><![CDATA[<p>to convert a decimal number into binary it&#8217;s just even more easy: use UNPACK!!</p>
<p>for example:</p>
<p>$number=5;<br />
print unpack &#8220;B8&#8243;, $number;   </p>
<p>will output:<br />
00000101</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saurabh</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-34179</link>
		<dc:creator>saurabh</dc:creator>
		<pubDate>Mon, 14 Apr 2008 16:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-34179</guid>
		<description>Oh sorry, never mind. oct converts from octal, i thought it was the string representation in octal of its arg.</description>
		<content:encoded><![CDATA[<p>Oh sorry, never mind. oct converts from octal, i thought it was the string representation in octal of its arg.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saurabh</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-34178</link>
		<dc:creator>saurabh</dc:creator>
		<pubDate>Mon, 14 Apr 2008 16:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-34178</guid>
		<description>&gt; But there’s no bin() function in Perl. You have to use oct() with a &quot;0b&quot; prefix:
&gt; $num = oct(&quot;0b&quot; . $bin);

And how exactly does that replace &quot;bin()&quot; (you know it&#039;s converting binary to octal right)?</description>
		<content:encoded><![CDATA[<p>&gt; But there’s no bin() function in Perl. You have to use oct() with a &#8220;0b&#8221; prefix:<br />
&gt; $num = oct(&#8220;0b&#8221; . $bin);</p>
<p>And how exactly does that replace &#8220;bin()&#8221; (you know it&#8217;s converting binary to octal right)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bharat</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-24257</link>
		<dc:creator>bharat</dc:creator>
		<pubDate>Thu, 27 Dec 2007 00:02:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-24257</guid>
		<description>Thanks a lot to William Ward &amp; Umut Topkara
This conversion had helped me a lot...</description>
		<content:encoded><![CDATA[<p>Thanks a lot to William Ward &amp; Umut Topkara<br />
This conversion had helped me a lot&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Praneel</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-1311</link>
		<dc:creator>Praneel</dc:creator>
		<pubDate>Tue, 03 Oct 2006 02:15:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-1311</guid>
		<description>Nice piece of work. Exactly what I wanted.</description>
		<content:encoded><![CDATA[<p>Nice piece of work. Exactly what I wanted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Ward</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-6</link>
		<dc:creator>William Ward</dc:creator>
		<pubDate>Mon, 30 Jan 2006 06:26:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-6</guid>
		<description>Yes, I mentioned that above (the &quot;%04o&quot; example) but you explained it better.  Thanks!</description>
		<content:encoded><![CDATA[<p>Yes, I mentioned that above (the &#8220;%04o&#8221; example) but you explained it better.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Umut Topkara</title>
		<link>http://www.bayview.com/blog/2002/08/15/octal-hexadecimal-and-decimal-conversion/comment-page-1/#comment-5</link>
		<dc:creator>Umut Topkara</dc:creator>
		<pubDate>Mon, 30 Jan 2006 02:39:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=14#comment-5</guid>
		<description>Hello,

Thank you for the helpful page. I&#039;d like to contribute my 0.2 cents.

Sometimes you to format with leading 0s, e.g. when encoding URLs, 
you need x0A rather than xA. For those cases you can use &quot;%0numberx&quot;
instead of &quot;%0x&quot; as the format string, and the sprintf will fill in
the necessary number of zeroes to make sure that the resulting string
is the specified number of characters.

Here&#039;s how we could use this to encode strings for URLs:
perl -pe &#039;s/([^a-zA-z])/&quot;\%&quot; . sprintf(&quot;%02x&quot;,ord($1))/eg&#039;

You could use it to send files as thunderbird emails from command line:

cat email.txt &#124; perl -pe &#039;s/([^a-zA-z])/&quot;\%&quot; . sprintf(&quot;%02x&quot;,ord($1))/eg&#039; &#124; xargs -iX thunderbird -compose &#039;mailto:somebody@nowhere.net?subject=PerlHack&amp;body=X&#039;

Hope this would be helpful to someone.

-umut</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>Thank you for the helpful page. I&#8217;d like to contribute my 0.2 cents.</p>
<p>Sometimes you to format with leading 0s, e.g. when encoding URLs,<br />
you need x0A rather than xA. For those cases you can use &#8220;%0numberx&#8221;<br />
instead of &#8220;%0x&#8221; as the format string, and the sprintf will fill in<br />
the necessary number of zeroes to make sure that the resulting string<br />
is the specified number of characters.</p>
<p>Here&#8217;s how we could use this to encode strings for URLs:<br />
perl -pe &#8216;s/([^a-zA-z])/&#8221;\%&#8221; . sprintf(&#8220;%02x&#8221;,ord($1))/eg&#8217;</p>
<p>You could use it to send files as thunderbird emails from command line:</p>
<p>cat email.txt | perl -pe &#8216;s/([^a-zA-z])/&#8221;\%&#8221; . sprintf(&#8220;%02x&#8221;,ord($1))/eg&#8217; | xargs -iX thunderbird -compose &#8216;mailto:somebody@nowhere.net?subject=PerlHack&amp;body=X&#8217;</p>
<p>Hope this would be helpful to someone.</p>
<p>-umut</p>
]]></content:encoded>
	</item>
</channel>
</rss>

