{"id":9864,"date":"2006-01-26T02:23:35","date_gmt":"2006-01-25T23:23:35","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=9864"},"modified":"2006-01-26T19:32:03","modified_gmt":"2006-01-26T16:32:03","slug":"decimal-to-binary-convertion-in-perl","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2006\/01\/26\/decimal-to-binary-convertion-in-perl\/","title":{"rendered":"Decimal to binary convertion in Perl"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>This is a simple thing, but when you need it &#8211; you need it.  There is no need in implementing a function that does or looking for a module at CPAN.  All you are looking for is already there.<\/p>\n<pre>\r\n#!\/usr\/bin\/perl -w\r\n\r\nuse strict;\r\n\r\n# Get the number from the command line or use default.\r\nmy $number = shift || 42;\r\n\r\nprintf \"%b\\n\", $number;\r\n<\/pre>\n<p>You might want to refresh you memory of <code>printf<\/code> or <code>sprintf<\/code> by flipping though the manual pages.<\/p>\n<p>P.S.: 42 decimal = 101010 binary.  Is it cool or what?<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>This is a simple thing, but when you need it &#8211; you need it. There is no need in implementing a function that does or looking for a module at CPAN. All you are looking for is already there. #!\/usr\/bin\/perl -w use strict; # Get the number from the command line or use default. my &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2006\/01\/26\/decimal-to-binary-convertion-in-perl\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Decimal to binary convertion in Perl<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18],"tags":[36,74],"keyring_services":[],"class_list":["post-9864","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","tag-perl","tag-tips"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":43485,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/09\/02\/perl-6-re-branding\/","url_meta":{"origin":9864,"position":0},"title":"Perl 6 re-branding","author":"Leonid Mamchenkov","date":"September 2, 2019","format":false,"excerpt":"Curtis \"Ovid\" Poe, the author of the book \"Beginning Perl\" and long-time Perl Monk, has this excellent post on the re-branding discussion of Perl 6. Even though I'm not writing much Perl code these days, I have to admit that the whole Perl 6 thing has been going for years\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7961,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/09\/26\/php-in-contrast-to-perl\/","url_meta":{"origin":9864,"position":1},"title":"PHP IN CONTRAST TO PERL","author":"Leonid Mamchenkov","date":"September 26, 2004","format":false,"excerpt":"There are plenty of holy wars on the web that argue about superiority of PHP over Perl and vice versa. There are many people who prefer PHP, and there are many others who prefer Perl. I am, of course, in the Perl camp. I have programmed both Perl and PHP\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8592,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/02\/05\/python-for-perl-programmers\/","url_meta":{"origin":9864,"position":2},"title":"Python for Perl programmers","author":"Leonid Mamchenkov","date":"February 5, 2005","format":false,"excerpt":"Slides for Matt Biddulph's speech \"Python for Perl programmers\" are a quick and easy way for Perl programmer to learn main differences between Perl and Python. Few code exmaples and quotes for the maestros are also included.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8533,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/01\/25\/practical-perl-programming\/","url_meta":{"origin":9864,"position":3},"title":"Practical Perl Programming","author":"Leonid Mamchenkov","date":"January 25, 2005","format":false,"excerpt":"If you really wanted to learn Perl programming language, you would have learned it already. But if your will was not enough, and you still haven't learned it, you do, probably, feel guilty every time you think about it. Just to give you yet another reason to fill the guilt\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7552,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/06\/06\/how-can-i-configure-vim-for-perl-programming\/","url_meta":{"origin":9864,"position":4},"title":"How can I configure Vim for Perl programming?","author":"Leonid Mamchenkov","date":"June 6, 2004","format":false,"excerpt":"\"vim embperl\" \"vim for programming\" \"perl indent vim\" \"vim ide\" \"vimrc syntax pl tab\" \"autocmd perl vim\" \".vimrc color perl\" I have put most of my knowledge on this matter into something I call \"Vim for Perl developers\". Read it - it has all the answers for you. :)","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":204,"url":"https:\/\/mamchenkov.net\/wordpress\/2003\/04\/28\/porting-php-to-perl\/","url_meta":{"origin":9864,"position":5},"title":"Porting PHP to Perl","author":"Leonid Mamchenkov","date":"April 28, 2003","format":false,"excerpt":"I am doing lots of perl programming these days. And there is yet lots more to come. I am currently porting most of my PHP code base to Perl. This provides a good practice, as well as code review and clean-up. Although, I know that porting is somewhat easier then\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/9864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=9864"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/9864\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=9864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=9864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=9864"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=9864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}