<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
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/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>beer planet &#187; Perl</title> <atom:link href="http://beerpla.net/category/perl/feed/" rel="self" type="application/rss+xml" /><link>http://beerpla.net</link> <description>where things have nothing to do with beer - tutorials, tips, how-tos, thoughts, hacks, and other techy nonsense</description> <lastBuildDate>Fri, 06 Jan 2012 08:50:59 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel='hub' href='http://beerpla.net/?pushpress=hub'/> <item><title>Hidden Features Of Perl, PHP, Javascript, C, C++, C#, Java, Ruby, Python, And Others [Collection Of Incredibly Useful Lists]</title><link>http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/</link> <comments>http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/#comments</comments> <pubDate>Sun, 21 Jun 2009 19:38:56 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[C]]></category> <category><![CDATA[C Sharp]]></category> <category><![CDATA[C++]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[Databases]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Perl]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Ruby]]></category> <category><![CDATA[asp.net]]></category> <category><![CDATA[bash]]></category> <category><![CDATA[code]]></category> <category><![CDATA[delphi]]></category> <category><![CDATA[Eclipse]]></category> <category><![CDATA[emacs]]></category> <category><![CDATA[f#]]></category> <category><![CDATA[feature]]></category> <category><![CDATA[featured]]></category> <category><![CDATA[flash]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[greasemonkey]]></category> <category><![CDATA[haskell]]></category> <category><![CDATA[hidden]]></category> <category><![CDATA[http]]></category> <category><![CDATA[jquery]]></category> <category><![CDATA[language]]></category> <category><![CDATA[lua]]></category> <category><![CDATA[mod_rewrite]]></category> <category><![CDATA[objective-c]]></category> <category><![CDATA[oracle]]></category> <category><![CDATA[program]]></category> <category><![CDATA[regex]]></category> <category><![CDATA[ror]]></category> <category><![CDATA[ruby on rails]]></category> <category><![CDATA[scala]]></category> <category><![CDATA[secret]]></category> <category><![CDATA[spring]]></category> <category><![CDATA[tcl]]></category> <category><![CDATA[vb.net]]></category> <category><![CDATA[xpath]]></category> <category><![CDATA[xslt]]></category> <guid
isPermaLink="false">http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/</guid> <description><![CDATA[<h2 align="left">Introduction</h2><p><a
href="http://www.stackoverflow.com">StackOverflow</a> is an amazing site for coding questions. It was created by <a
href="http://twitter.com/Spolsky" rel="nofollow">Joel Spolsky</a> of <a
href="http://joelonsoftware.com" rel="nofollow">joelonsoftware.com</a>, <a
href="http://twitter.com/codinghorror" rel="nofollow">Jeff Atwood</a> of <a
href="http://codinghorror.com" rel="nofollow">codinghorror.com</a>, and some other incredibly smart guys who truly care about user experience. I have been a total fan of SO since it went mainstream and it&#039;s now a borderline addiction (you can see my StackOverflow badge on the right sidebar).</p><h2 align="left">The Story</h2><p
align="left"><div
class="note"><div
class="noteimportant"></div></div></p><p
align="left"><strong>Update 6/21/09</strong>: This server is currently under very heavy load (10-200), even with caching plugins enabled. Please bear with me as I try to resolve the situation.</p><p
align="left">Feel free to <a
href="http://www.addtoany.com/share_save?&#38;linkurl=http%3A%2F%2Fbeerpla.net%2F2009%2F06%2F21%2Fhidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists%2F&#38;linkname=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D">bookmark this page</a> and return to it later when the fires have...<div
class=clear></div> <a
href="http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<h2 align="left">Introduction</h2><p><a
href="http://www.stackoverflow.com">StackOverflow</a> is an amazing site for coding questions. It was created by <a
href="http://twitter.com/Spolsky" rel="nofollow">Joel Spolsky</a> of <a
href="http://joelonsoftware.com" rel="nofollow">joelonsoftware.com</a>, <a
href="http://twitter.com/codinghorror" rel="nofollow">Jeff Atwood</a> of <a
href="http://codinghorror.com" rel="nofollow">codinghorror.com</a>, and some other incredibly smart guys who truly care about user experience. I have been a total fan of SO since it went mainstream and it&#039;s now a borderline addiction (you can see my StackOverflow badge on the right sidebar).</p><h2 align="left">The Story</h2><p
align="left"><div
class="note"><div
class="noteimportant"></p><p
align="left"><strong>Update 6/21/09</strong>: This server is currently under very heavy load (10-200), even with caching plugins enabled. Please bear with me as I try to resolve the situation.</p><p
align="left">Feel free to <a
href="http://www.addtoany.com/share_save?&amp;linkurl=http%3A%2F%2Fbeerpla.net%2F2009%2F06%2F21%2Fhidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists%2F&amp;linkname=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D">bookmark this page</a> and return to it later when the fires have been put out.</p><p
align="left"><strong>Update 06/21/09</strong>: I think I&#039;ve got the situation under control now. The load is between 0 and 3 now and pages load relatively fast. I will be posting about the getting redditted/delicioused experience later.</p><p
align="left"><strong>Update 06/23/09</strong>: Added jQuery, Greasemonkey, Ruby on Rails, and Objective-C, broke databases into their own section, and sorted everything alphabetically.</p><p
align="left"><strong>Update 06/23/09</strong>: Added Scala, Lua, TCL, F#, Regex, and HTTP.</p><p
align="left"><strong>Update 07/21/09</strong>: Added ActionScript3/Flex, Erlang, PL/SQL, Silverlight, VBA, VHDL, WPF/XAML.</p><p
align="left"><strong>Update 10/24/09</strong>: Added Flash development/language/IDE, Emacs, Xpath/Xslt, Spring framework.</p><p
align="left"><strong>Update 01/18/10</strong>: Added Android (asked by yours truly), Qt, Django, Windows.Forms, R, Lisp, x86 assembly, Grails.</p><p
align="left"></div></div></p><p>So, one day someone at StackOverflow started a &quot;Hidden features of&quot; post about a famous language (I don&#039;t feel like finding out which one was first exactly), and it turned out to be so popular that other posts in the same series started popping up.</p><p>Such questions were quickly turned into community wikis, for the purposes of harvesting and organizing information coming from the best developers on the planet and voted by users of the site. There are literally hundreds of answers, sorted by votes.</p><p><div
class="note"><div
class="notetip">The Hidden Features series is great for people who are new to a certain language. It shows the ropes and tricks, all in one place, in the most concise manner possible. Even pros oftentimes find features of their favorite language that they&#039;d never heard about.</div></div></p><h2 align="center">Hidden Features Of</h2><h3>Programming Languages</h3><h4><a
href="http://stackoverflow.com/questions/1103705/hidden-features-of-actionscript3-flex">Hidden features of ActionScript3 / Flex</a></h4><h4><a
href="http://stackoverflow.com/questions/54929/hidden-features-of-asp-net">Hidden features of ASP.NET </a></h4><h4><a
href="http://stackoverflow.com/questions/1574308/hidden-features-of-x86-assembly-language" rel="nofollow">Hidden features of x86 assembly</a></h4><h4><a
href="http://stackoverflow.com/questions/132241/hidden-features-of-c">Hidden features of C</a></h4><h4><a
href="http://stackoverflow.com/questions/75538/hidden-features-of-c">Hidden features of C++</a></h4><h4><a
href="http://stackoverflow.com/questions/9033/hidden-features-of-c">Hidden features of C#</a></h4><h4><a
href="http://stackoverflow.com/questions/1853653/hidden-features-of-coldfusion" rel="nofollow">Hidden features of ColdFusion</a></h4><h4><a
href="http://stackoverflow.com/questions/125008/hidden-features-of-d">Hidden features of D </a></h4><h4><a
href="http://stackoverflow.com/questions/102254/hidden-features-of-delphi" rel="nofollow">Hidden features of Delphi</a></h4><h4><a
href="http://stackoverflow.com/questions/1063497/hidden-features-of-erlang" rel="nofollow">Hidden features of Erlang</a></h4><h4><a
href="http://stackoverflow.com/questions/181613/hidden-features-of-f">Hidden features of F# </a></h4><h4><a
href="http://stackoverflow.com/questions/1160680/hidden-features-tricks-of-flash-development-flash-language-as2-3-and-flash-id" rel="nofollow">Hidden features of Flash development, Flash language (AS2/3), and Flash IDE</a></h4><h4><a
href="http://stackoverflow.com/questions/15496/hidden-features-of-java">Hidden features of Java</a></h4><h4><a
href="http://stackoverflow.com/questions/61088/hidden-features-of-javascript">Hidden features of JavaScript</a></h4><h4><a
href="http://stackoverflow.com/questions/211216/hidden-features-of-haskell">Hidden features of Haskell </a></h4><h4><a
href="http://stackoverflow.com/questions/1598854/hidden-features-of-emacs-lisp" rel="nofollow">Hidden features of Lisp</a></h4><h4><a
href="http://stackoverflow.com/questions/523867/hidden-features-of-lua">Hidden features of Lua </a></h4><h4><a
href="http://stackoverflow.com/questions/211616/hidden-features-of-objective-c">Hidden features of Objective-C </a></h4><h4><a
href="http://stackoverflow.com/questions/161872/hidden-features-of-perl">Hidden features of Perl</a></h4><h4><a
href="http://stackoverflow.com/questions/61401/hidden-features-of-php">Hidden features of PHP</a></h4><h4><a
href="http://stackoverflow.com/questions/101268/hidden-features-of-python">Hidden features of Python</a></h4><h4><a
href="http://stackoverflow.com/questions/1682874/hidden-features-of-r" rel="nofollow">Hidden features of R</a></h4><h4><a
href="http://stackoverflow.com/questions/63998/hidden-features-of-ruby">Hidden features of Ruby</a></h4><h4><a
href="http://stackoverflow.com/questions/709679/hidden-features-of-ruby-on-rails">Hidden features of Ruby on Rails </a></h4><h4><a
href="http://stackoverflow.com/questions/1025181/hidden-features-of-scala">Hidden features of Scala </a></h4><h4><a
href="http://stackoverflow.com/questions/1031450/are-there-any-undocumented-features-in-silverlight">Hidden features of Silverlight</a></h4><h4><a
href="http://stackoverflow.com/questions/1596139/hidden-features-and-dark-corners-of-stl" rel="nofollow">Hidden features and Dark Corners of STL?</a></h4><h4><a
href="http://stackoverflow.com/questions/1024711/hidden-features-of-tcl-tk">Hidden features of TCL/TK</a></h4><h4><a
href="http://stackoverflow.com/questions/102084/hidden-features-of-vb-net">Hidden features of VB.Net </a></h4><h4><a
href="http://stackoverflow.com/questions/1070863/hidden-features-of-vba">Hidden features of VBA</a></h4><h3>Databases</h3><h4><a
href="http://stackoverflow.com/questions/368858/hidden-features-of-mysql">Hidden features of MySQL </a></h4><h4><a
href="http://stackoverflow.com/questions/381231/hidden-features-in-oracle">Hidden features of Oracle </a></h4><h4><a
href="http://stackoverflow.com/questions/1031485/hidden-features-of-pl-sql">Hidden features of PL/SQL</a></h4><h4><a
href="http://stackoverflow.com/questions/761327/hidden-features-of-postgresql">Hidden features of PostgreSQL </a></h4><h4><a
href="http://stackoverflow.com/questions/121243/hidden-features-of-sql-server">Hidden features of SQL Server </a></h4><h3>Mobile</h3><h4><a
href="http://stackoverflow.com/questions/1619133/hidden-features-of-android-development" rel="nofollow">Hidden features of Android development</a></h4><h3>Other</h3><h4><a
href="http://stackoverflow.com/questions/211378/hidden-features-of-bash">Hidden features of Bash</a> &#8211; also see my <a
href="http://beerpla.net/2008/12/22/mastering-the-linux-shell-bash-shortcuts-explained/">bash cheatsheet</a>.</h4><h4><a
href="http://stackoverflow.com/questions/628407/css-hidden-features">Hidden features of CSS</a></h4><h4><a
href="http://stackoverflow.com/questions/1858520/hidden-features-of-django" rel="nofollow">Hidden features of Django</a></h4><h4><a
href="http://stackoverflow.com/questions/54886/hidden-features-tricks-for-eclipse">Hidden features of Eclipse </a></h4><h4><a
href="http://stackoverflow.com/questions/1598854/hidden-features-of-emacs-lisp" rel="nofollow">Hidden features of Emacs</a></h4><h4><a
href="http://stackoverflow.com/questions/1330531/hidden-features-of-grails" rel="nofollow">Hidden features of Grails</a></h4><h4><a
href="http://stackoverflow.com/questions/121167/hidden-features-of-greasemonkey">Hidden features of Greasemonkey </a></h4><h4><a
href="http://stackoverflow.com/questions/954327/hidden-features-of-html">Hidden features of HTML </a></h4><h4><a
href="http://stackoverflow.com/questions/954894/hidden-features-of-http">Hidden features of HTTP </a></h4><h4><a
href="http://stackoverflow.com/questions/121965/hidden-or-not-widely-known-features-of-jquery">Hidden features of jQuery</a></h4><h4><a
href="http://stackoverflow.com/questions/286004/hidden-features-of-modrewrite">Hidden features of mod_rewrite </a></h4><h4><a
href="http://stackoverflow.com/questions/1826458/hidden-features-of-qt" rel="nofollow">Hidden features of Qt</a></h4><h4><a
href="http://stackoverflow.com/questions/868181/hidden-features-of-regex">Hidden features of RegEx </a></h4><h4><a
href="http://stackoverflow.com/questions/1416423/hidden-features-of-spring-framework">Hidden features of Spring framework </a></h4><h4><a
href="http://stackoverflow.com/questions/1025699/hidden-features-of-vhdl">Hidden features of VHDL</a></h4><h4><a
href="http://stackoverflow.com/questions/100420/hidden-features-of-visual-studio-2005-2008">Hidden features of Visual Studio (2005-2008) </a></h4><h4><a
href="http://stackoverflow.com/questions/1777303/hidden-features-of-windows-forms" rel="nofollow">Hidden features of Windows.Forms</a></h4><h4><a
href="http://stackoverflow.com/questions/1124769/hidden-features-of-wpf-and-xaml">Hidden features of WPF and XAML</a></h4><h4><a
href="http://stackoverflow.com/questions/1521851/hidden-features-of-xpathxslt">Hidden features of Xpath+Xslt</a></h4><p>I will try to maintain this list, adding new languages that join the series as I find them. Now go learn something new!</p><div
class='post_blob_1'>Real <a
href="http://www.test-king.com/exams/70-432.htm">70-432</a> exam preparation with help of easy to understand <a
href="http://www.test-king.com/exams/220-702.htm">220-702</a> notes and <a
href="http://www.test-king.com/exams/640-553.htm">640-553</a> practice questions.</div><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden+Features+Of+Perl%2C+PHP%2C+Javascript%2C+C%2C+C%2B%2B%2C+C%23%2C+Java%2C+Ruby%2C+Python%2C+And+Others+%5BCollection+Of+Incredibly+Useful+Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D&amp;link=http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/&amp;notes=Introduction%0D%0AStackOverflow%20is%20an%20amazing%20site%20for%20coding%20questions.%20It%20was%20created%20by%20Joel%20Spolsky%20of%20joelonsoftware.com%2C%20Jeff%20Atwood%20of%20codinghorror.com%2C%20and%20some%20other%20incredibly%20smart%20guys%20who%20truly%20care%20about%20user%20experience.%20I%20have%20been%20a%20total%20fan%20of%20SO%20since%20it%20went%20mainstream%20and%20it%27s%20now%20a&amp;short_link=http://bit.ly/capw5J&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2009/10/24/are-you-a-stackoverflow-com-superuser-com-serverfault-com-fan-heres-a-greasemonkey-script-to-keep-track-of-your-accounts-on-all-of-them/" rel="bookmark" title="October 24, 2009">StackOverflow.com, SuperUser.com, ServerFault.com Fan? Here&#039;s A Greasemonkey Script To Keep Track Of All Your Accounts</a></li><li><a
href="http://beerpla.net/2009/09/03/comparison-between-solr-and-sphinx-search-servers-solr-vs-sphinx-fight/" rel="bookmark" title="September 3, 2009">Comparison Between Solr And Sphinx Search Servers (Solr Vs Sphinx &#8211; Fight!)</a></li><li><a
href="http://beerpla.net/2009/03/17/twitter-autocomplete-auto-url-expansion-auto-url-shortener-auto-pagination-rt-button-nested-replies-inline-media-embed-search-tabs-and-more/" rel="bookmark" title="March 17, 2009">Twitter.com Autocomplete, Auto URL Expansion, Auto URL Shortener, RT Button, Nested Replies, Inline Media Embed, Search Tabs, And More</a></li><li><a
href="http://beerpla.net/2010/01/18/wordpress-developers-how-do-you-make-a-living-poll-discussion/" rel="bookmark" title="January 18, 2010">WordPress Developers &#8211; How Do You Make A Living [Poll + Discussion]?</a></li><li><a
href="http://beerpla.net/2009/08/18/delicious-com-quietly-rolls-out-domain-and-url-searchingfiltering-finally/" rel="bookmark" title="August 18, 2009">Delicious.com [Quietly] Rolls Out Domain And Url Searching/Filtering. Finally!</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F06%2F21%2Fhidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists%2F&amp;title=Hidden%20Features%20Of%20Perl%2C%20PHP%2C%20Javascript%2C%20C%2C%20C%2B%2B%2C%20C%23%2C%20Java%2C%20Ruby%2C%20Python%2C%20And%20Others%20%5BCollection%20Of%20Incredibly%20Useful%20Lists%5D" id="wpa2a_2"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/06/21/hidden-features-of-perl-php-javascript-c-c-c-java-ruby-python-and-others-collection-of-incredibly-useful-lists/feed/</wfw:commentRss> <slash:comments>23</slash:comments> </item> <item><title>[Perl] Finding Files, The Fun And Elegant Way</title><link>http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/</link> <comments>http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/#comments</comments> <pubDate>Wed, 08 Apr 2009 14:00:00 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Awesomeness]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Perl]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Tutorials]]></category> <category><![CDATA[efficient]]></category> <category><![CDATA[elegant]]></category> <category><![CDATA[file]]></category> <category><![CDATA[find]]></category> <category><![CDATA[follow]]></category> <category><![CDATA[fun]]></category> <category><![CDATA[robust]]></category> <category><![CDATA[search]]></category> <category><![CDATA[skip]]></category> <category><![CDATA[SVN]]></category> <category><![CDATA[symlink]]></category> <guid
isPermaLink="false">http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/</guid> <description><![CDATA[<p>No matter what programming language you use, there comes a time when you need to search for a file somewhere on the file system. Here, I want to talk about accomplishing this task in Perl. There are many ways of doing so, most of them boring, but I want to discuss the fun and elegant way &#8211; using <a
href="http://search.cpan.org/dist/File-Find-Rule/lib/File/Find/Rule.pm" rel="nofollow">File::Find::Rule</a>.</p><p>Let me briefly discuss some of the other methods first.</p><h2>Limited</h2><p>Using glob() (or &#60;&#62;, TODO verify) you can find files in a single directory, using only the limited shell wildcard support. For example,</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre>my @files = glob(&#34;tmp*&#34;);</pre></td></tr></table></div><p><div
class="note"><div
class="noteclassic">I prefer glob() to &#60;&#62; because glob()&#039;s parameters can be more than just text (for ex functions) while &#60;&#62;</div></div>...<div
class=clear></div> <a
href="http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p>No matter what programming language you use, there comes a time when you need to search for a file somewhere on the file system. Here, I want to talk about accomplishing this task in Perl. There are many ways of doing so, most of them boring, but I want to discuss the fun and elegant way &#8211; using <a
href="http://search.cpan.org/dist/File-Find-Rule/lib/File/Find/Rule.pm" rel="nofollow">File::Find::Rule</a>.</p><p>Let me briefly discuss some of the other methods first.</p><h2>Limited</h2><p>Using glob() (or &lt;&gt;, TODO verify) you can find files in a single directory, using only the limited shell wildcard support. For example,</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre>my @files = glob(&quot;tmp*&quot;);</pre></td></tr></table></div><p><div
class="note"><div
class="noteclassic">I prefer glob() to &lt;&gt; because glob()&#039;s parameters can be more than just text (for ex functions) while &lt;&gt; treats everything inside as text.</div></div></p><h2>Boring</h2><p><a
title="http://search.cpan.org/~nwclark/perl-5.8.9/lib/File/Find.pm" href="http://search.cpan.org/~nwclark/perl-5.8.9/lib/File/Find.pm">File::Find</a> is the de facto standard for searching in Perl.</p><p>This method finds files that end in .pl in &quot;.&quot; and &quot;../SomeDir&quot;, following symlinks:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td
class="code"><pre>#!/usr/bin/perl -w
&nbsp;
use File::Find;
use Data::Dumper;
use File::Basename;
my @directories_to_search = (&quot;.&quot;, &quot;../SomeDir&quot;);
my @file_list = ();
&nbsp;
find(
  { wanted =&gt;
    sub {
      if ( basename($File::Find::name) =~ /\.pl$/i )
      {
        push @file_list, $File::Find::name;
      }
    },
    follow =&gt; 1
  },
  @directories_to_search
);
print Dumper @file_list;</pre></td></tr></table></div><p>It works fine, except it&#039;s horribly ugly and boring. Let&#039;s have a look at something more fun.</p><h2>The Fun And Elegant Way</h2><p><a
title="http://search.cpan.org/dist/File-Find-Rule/lib/File/Find/Rule.pm" href="http://search.cpan.org/dist/File-Find-Rule/lib/File/Find/Rule.pm" rel="nofollow">File::Find::Rule</a>. Just have a look at this beauty.</p><p>Just like above, find all .pl files in &quot;.&quot; and &quot;../SomeDir&quot;, following symlinks:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code"><pre>print Dumper (File::Find::Rule-&gt;name(&quot;*.pl&quot;)-&gt;file-&gt;extras({ follow =&gt; 1 })-&gt;
in(&quot;.&quot;, &quot;../SomeDir&quot;));</pre></td></tr></table></div><p>Same as above, except bypass .svn directories (shaves off a ton of time with a lot of directories):</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code"><pre>print Dumper (File::Find::Rule-&gt;not(File::Find::Rule-&gt;directory-&gt;name('.svn')-&gt;
prune-&gt;discard)-&gt;name(&quot;*.pl&quot;)-&gt;file-&gt;extras({ follow =&gt; 1 })-&gt;in(&quot;.&quot;, &quot;../SomeDir&quot;));</pre></td></tr></table></div><p>Find all .log files that are older than 24 hours in &quot;.&quot;</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
</pre></td><td
class="code"><pre>my $epoch_time_1_day_ago = time() - 60*60*24;
print Dumper (File::Find::Rule-&gt;file-&gt;name(&quot;*.log&quot;)-&gt;
mtime(&quot;&lt;$epoch_time_1_day_ago&quot;)-&gt;in('.'));</pre></td></tr></table></div><p>Be sure to read the <a
href="http://search.cpan.org/dist/File-Find-Rule/lib/File/Find/Rule.pm" rel="nofollow">File::Find::Rule</a> perldoc for more options and remember: have fun with your code!<a
href="http://www.weblocal.ca"></a></p><p>Thanks to <a
href="http://perlbuzz.com/" rel="nofollow">Perlbuzz</a> and Andy Lester for <a
href="http://perlbuzz.com/mechanix/2008/05/optimizing-file-searches-with.html" rel="nofollow">pointing me</a> to this library a few months ago.</p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+Finding+Files%2C+The+Fun+And+Elegant+Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+Finding+Files%2C+The+Fun+And+Elegant+Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+Finding+Files%2C+The+Fun+And+Elegant+Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+Finding+Files%2C+The+Fun+And+Elegant+Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+Finding+Files%2C+The+Fun+And+Elegant+Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+Finding+Files%2C+The+Fun+And+Elegant+Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+Finding+Files%2C+The+Fun+And+Elegant+Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D%20Finding%20Files%2C%20The%20Fun%20And%20Elegant%20Way&amp;link=http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/&amp;notes=No%20matter%20what%20programming%20language%20you%20use%2C%20there%20comes%20a%20time%20when%20you%20need%20to%20search%20for%20a%20file%20somewhere%20on%20the%20file%20system.%20Here%2C%20I%20want%20to%20talk%20about%20accomplishing%20this%20task%20in%20Perl.%20There%20are%20many%20ways%20of%20doing%20so%2C%20most%20of%20them%20boring%2C%20but%20I%20want%20to%20discuss%20the%20fun%20and%20elegant%20way%20-%20using%20Fil&amp;short_link=http://bit.ly/caZusS&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/" rel="bookmark" title="March 5, 2009">[Perl] How To Get The Path Of An Included Library (.pm), Regardless Of Current Directory</a></li><li><a
href="http://beerpla.net/2007/10/28/ftprush-cleanup-script/" rel="bookmark" title="October 28, 2007">FTPRush Cleanup Script</a></li><li><a
href="http://beerpla.net/2008/03/21/quick-snippet-finding-if-a-file-has-a-media-extension-using-regex/" rel="bookmark" title="March 21, 2008">Quick Perl Snippet: Finding If A File Has A Media Extension Using Regex</a></li><li><a
href="http://beerpla.net/2008/07/23/how-to-check-if-the-local-svn-revision-is-up-to-date/" rel="bookmark" title="July 23, 2008">How To Check If The Local SVN Revision Is Up-To-Date</a></li><li><a
href="http://beerpla.net/2008/10/11/how-to-sort-folders-the-same-way-as-files-in-total-commander/" rel="bookmark" title="October 11, 2008">How To Sort Folders The Same Way As Files In Total Commander</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F04%2F08%2Fperl-finding-files-the-fun-and-elegant-way%2F&amp;title=%5BPerl%5D%20Finding%20Files%2C%20The%20Fun%20And%20Elegant%20Way" id="wpa2a_4"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>[Perl] How To Get The Path Of An Included Library (.pm), Regardless Of Current Directory</title><link>http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/</link> <comments>http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/#comments</comments> <pubDate>Fri, 06 Mar 2009 05:41:02 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Perl]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[dir]]></category> <category><![CDATA[directory]]></category> <category><![CDATA[INC]]></category> <category><![CDATA[include]]></category> <category><![CDATA[library]]></category> <category><![CDATA[path]]></category> <category><![CDATA[script]]></category> <guid
isPermaLink="false">http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/</guid> <description><![CDATA[<h2>Problem</h2><p>While writing a 1093985th Perl script the other day I was facing the following dilemma:</p><ul><li>Let’s say there is a local library, called <em>TheUberLib.pm</em>. It is so uber that most of my scripts, located all over the machine, include it.</li><li>Now, let’s also say that there’s an even more uberly important binary called <em>run_me_now_or_you_will_die</em> but the only way to find it is by using a relative path to the aforementioned <em>TheUberLib.pm</em>, for example <em>../bin</em> (RELATIVE TO <em>TheUberLib.pm)</em>.</li><li>I don’t want to hardcode the path to <em>run_me_now_or_you_will_die </em>because it can be different on multiple machines and the code wouldn’t be robust enough – all I know is that the path is relative to an included library.</li></ul><p>...<div
class=clear></div> <a
href="http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<h2>Problem</h2><p>While writing a 1093985th Perl script the other day I was facing the following dilemma:</p><ul><li>Let’s say there is a local library, called <em>TheUberLib.pm</em>. It is so uber that most of my scripts, located all over the machine, include it.</li><li>Now, let’s also say that there’s an even more uberly important binary called <em>run_me_now_or_you_will_die</em> but the only way to find it is by using a relative path to the aforementioned <em>TheUberLib.pm</em>, for example <em>../bin</em> (RELATIVE TO <em>TheUberLib.pm)</em>.</li><li>I don’t want to hardcode the path to <em>run_me_now_or_you_will_die </em>because it can be different on multiple machines and the code wouldn’t be robust enough – all I know is that the path is relative to an included library.</li></ul><p>So how does one get the path to an included <em>TheUberLib.pm </em>(in my case to deduce the path to <em>run_me_now_or_you_will_die</em>),<em> </em>regardless of the script location and the current directory?</p><p>I started looking at all possible ways of getting this information.</p><ul><li>At first I looked at $0. $0 returns the path to the Perl script itself (<em>LibraryPath/lib_path.pl</em>) and is completely useless here.</li><li>The <em>FindBin </em>module that I sometimes use was also of no help as it also deals with the caller script path.</li></ul><h2>Solution</h2><p>After digging around for a bit, this is the method I came up with that did exactly what I wanted:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code"><pre>use File::Basename;
my $path_to_uber_lib = dirname($INC{'TheUberLib.pm'});</pre></td></tr></table></div><p>and the clean way to get the final path to <em>run_me_now_or_you_will_die</em> is:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
</pre></td><td
class="code"><pre>my $relative_path_to_bin_dir = &quot;../the_path_we_want/run_me_now_or_you_will_die&quot;;
my $path_to_deadly_bin = Cwd::realpath(&quot;$path_to_uber_lib/$relative_path_to_bin_dir&quot;);
print &quot;The path to deadly bin is: $path_to_deadly_bin\n&quot;;</pre></td></tr></table></div><p>which prints <em>/tmp/LibraryPath/some_path1/the_path_we_want/run_me_now_or_you_will_die.</em></p><p>Here is the full program with all directories that you can check out from SVN:</p><div
class="wp_syntax"><div
class="code"><pre>svn co http://beerpla.net/svn/public/Perl/LibraryPath/</pre></div></div><p>or just browse the code here: <a
href="http://beerpla.net/svn/public/Perl/LibraryPath/">http://beerpla.net/svn/public/Perl/LibraryPath/</a></p><h2>Explanation</h2><p>The <em>%INC</em> hash contains all included libraries, with library names as keys and full paths as values.</p><p>The <em>dirname()</em> function is part of <a
href="http://perldoc.perl.org/File/Basename.html" rel="nofollow">File::Basename</a><em></em> and returns just the directory part of the path.</p><p>Finally, <a
href="http://perldoc.perl.org/Cwd.html" rel="nofollow">Cwd::realpath()</a><em></em> is a function that resolves relative and symbolic links to canonical absolute ones.</p><p>And there you have it.</p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+How+To+Get+The+Path+Of+An+Included+Library+%28.pm%29%2C+Regardless+Of+Current+Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+How+To+Get+The+Path+Of+An+Included+Library+%28.pm%29%2C+Regardless+Of+Current+Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+How+To+Get+The+Path+Of+An+Included+Library+%28.pm%29%2C+Regardless+Of+Current+Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+How+To+Get+The+Path+Of+An+Included+Library+%28.pm%29%2C+Regardless+Of+Current+Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+How+To+Get+The+Path+Of+An+Included+Library+%28.pm%29%2C+Regardless+Of+Current+Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+How+To+Get+The+Path+Of+An+Included+Library+%28.pm%29%2C+Regardless+Of+Current+Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D+How+To+Get+The+Path+Of+An+Included+Library+%28.pm%29%2C+Regardless+Of+Current+Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=%5BPerl%5D%20How%20To%20Get%20The%20Path%20Of%20An%20Included%20Library%20%28.pm%29%2C%20Regardless%20Of%20Current%20Directory&amp;link=http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/&amp;notes=Problem%20%20While%20writing%20a%201093985th%20Perl%20script%20the%20other%20day%20I%20was%20facing%20the%20following%20dilemma%3A%20%20%20%20%20Let%E2%80%99s%20say%20there%20is%20a%20local%20library%2C%20called%20TheUberLib.pm.%20It%20is%20so%20uber%20that%20most%20of%20my%20scripts%2C%20located%20all%20over%20the%20machine%2C%20include%20it.%20%20%20%20%20Now%2C%20let%E2%80%99s%20also%20say%20that%20there%E2%80%99s%20an%20even%20more%20uber&amp;short_link=http://bit.ly/cVf4Vf&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2007/10/28/ftprush-cleanup-script/" rel="bookmark" title="October 28, 2007">FTPRush Cleanup Script</a></li><li><a
href="http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/" rel="bookmark" title="April 29, 2008">How Do I Get Both The Return Value And Text In Perl? Backticks vs. System() (Perl 5.10)</a></li><li><a
href="http://beerpla.net/2009/04/08/perl-finding-files-the-fun-and-elegant-way/" rel="bookmark" title="April 8, 2009">[Perl] Finding Files, The Fun And Elegant Way</a></li><li><a
href="http://beerpla.net/2008/03/27/parsing-json-in-perl-by-example-southparkstudioscom-south-park-episodes/" rel="bookmark" title="March 27, 2008">Parsing JSON In Perl By Example &#8211; SouthParkStudios.com South Park Episodes</a></li><li><a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/" rel="bookmark" title="January 13, 2010">[WordPress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F03%2F05%2Fperl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory%2F&amp;title=%5BPerl%5D%20How%20To%20Get%20The%20Path%20Of%20An%20Included%20Library%20%28.pm%29%2C%20Regardless%20Of%20Current%20Directory" id="wpa2a_6"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>How Do I Get Both The Return Value And Text In Perl? Backticks vs. System() (Perl 5.10)</title><link>http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/</link> <comments>http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/#comments</comments> <pubDate>Wed, 30 Apr 2008 01:52:28 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Perl]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[annoying]]></category> <category><![CDATA[backtick]]></category> <category><![CDATA[child]]></category> <category><![CDATA[error code]]></category> <category><![CDATA[perl 5.10]]></category> <category><![CDATA[perldelta]]></category> <category><![CDATA[perlrun]]></category> <category><![CDATA[problem]]></category> <category><![CDATA[return value]]></category> <category><![CDATA[system]]></category> <guid
isPermaLink="false">http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/</guid> <description><![CDATA[<p>I&#039;m sure most Perl coders have to face this annoying problem at one point or another: how do you consistently get the return value out of a system call, be at executed via backticks or system()? Backticks return the output of the program with no error code in sight, while system() returns the error code but prints the output instead of putting it into a variable.</p><p>The best solution I could find to this problem to date was posted at <a
title="http://www.perlmonks.org/?node_id=19119" href="http://www.perlmonks.org/?node_id=19119">http://www.perlmonks.org/?node_id=19119</a> and involved opening a piped filehandle. It worked quite well but always felt like a hack (which it was). Having used the new <a
href="http://dev.perl.org/perl5/news/2007/perl-5.10.0.html">Perl 5.10</a> for a few months, I was shocked today to find this...<div
class=clear></div> <a
href="http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p>I&#039;m sure most Perl coders have to face this annoying problem at one point or another: how do you consistently get the return value out of a system call, be at executed via backticks or system()? Backticks return the output of the program with no error code in sight, while system() returns the error code but prints the output instead of putting it into a variable.</p><p>The best solution I could find to this problem to date was posted at <a
title="http://www.perlmonks.org/?node_id=19119" href="http://www.perlmonks.org/?node_id=19119">http://www.perlmonks.org/?node_id=19119</a> and involved opening a piped filehandle. It worked quite well but always felt like a hack (which it was). Having used the new <a
href="http://dev.perl.org/perl5/news/2007/perl-5.10.0.html">Perl 5.10</a> for a few months, I was shocked today to find this new variable that I&#039;ve been dreaming about for years:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre>${^CHILD_ERROR_NATIVE}</pre></td></tr></table></div><p>This variable gives the native status returned by the last pipe close, <strong>backtick command</strong>, successful call to wait() or waitpid(), or from the <strong>system()</strong> operator. See perlrun for details. (Contributed by Gisle Aas.)</p><p><a
href="http://search.cpan.org/dist/perl-5.10.0/pod/perl5100delta.pod#New_internal_variables">http://search.cpan.org/dist/perl-5.10.0/pod/perl5100delta.pod#New_internal_variables</a></p><p>I&#039;ve just tested it and it works as described. Finally!.. what else can I say?</p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=How+Do+I+Get+Both+The+Return+Value+And+Text+In+Perl%3F+Backticks+vs.+System%28%29+%28Perl+5.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=How+Do+I+Get+Both+The+Return+Value+And+Text+In+Perl%3F+Backticks+vs.+System%28%29+%28Perl+5.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=How+Do+I+Get+Both+The+Return+Value+And+Text+In+Perl%3F+Backticks+vs.+System%28%29+%28Perl+5.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=How+Do+I+Get+Both+The+Return+Value+And+Text+In+Perl%3F+Backticks+vs.+System%28%29+%28Perl+5.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=How+Do+I+Get+Both+The+Return+Value+And+Text+In+Perl%3F+Backticks+vs.+System%28%29+%28Perl+5.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=How+Do+I+Get+Both+The+Return+Value+And+Text+In+Perl%3F+Backticks+vs.+System%28%29+%28Perl+5.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=How+Do+I+Get+Both+The+Return+Value+And+Text+In+Perl%3F+Backticks+vs.+System%28%29+%28Perl+5.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=How%20Do%20I%20Get%20Both%20The%20Return%20Value%20And%20Text%20In%20Perl%3F%20Backticks%20vs.%20System%28%29%20%28Perl%205.10%29&amp;link=http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/&amp;notes=I%27m%20sure%20most%20Perl%20coders%20have%20to%20face%20this%20annoying%20problem%20at%20one%20point%20or%20another%3A%20how%20do%20you%20consistently%20get%20the%20return%20value%20out%20of%20a%20system%20call%2C%20be%20at%20executed%20via%20backticks%20or%20system%28%29%3F%20Backticks%20return%20the%20output%20of%20the%20program%20with%20no%20error%20code%20in%20sight%2C%20while%20system%28%29%20returns%20the%20error%20&amp;short_link=http://bit.ly/a8k2E6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/06/10/how-to-display-just-the-http-response-code-in-cli-curl/" rel="bookmark" title="June 10, 2010">How To Display Just The HTTP Response Code In Command Line Curl</a></li><li><a
href="http://beerpla.net/2008/07/23/how-to-check-if-the-local-svn-revision-is-up-to-date/" rel="bookmark" title="July 23, 2008">How To Check If The Local SVN Revision Is Up-To-Date</a></li><li><a
href="http://beerpla.net/2008/04/16/mysql-conference-liveblogging-monitoring-tools-wednesday-515pm/" rel="bookmark" title="April 16, 2008">MySQL Conference Liveblogging: Monitoring Tools (Wednesday 5:15PM)</a></li><li><a
href="http://beerpla.net/2009/03/05/perl-how-to-get-the-path-of-an-included-library-pm-regardless-of-current-directory/" rel="bookmark" title="March 5, 2009">[Perl] How To Get The Path Of An Included Library (.pm), Regardless Of Current Directory</a></li><li><a
href="http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/" rel="bookmark" title="August 4, 2007">Watch &#8211; A Useful Linux Command You May Have Never Heard Of</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2008%2F04%2F29%2Fhow-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510%2F&amp;title=How%20Do%20I%20Get%20Both%20The%20Return%20Value%20And%20Text%20In%20Perl%3F%20Backticks%20vs.%20System%28%29%20%28Perl%205.10%29" id="wpa2a_8"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2008/04/29/how-do-i-get-both-the-return-value-and-text-in-perl-backticks-vs-system-perl-510/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
