<?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: Perl geekery: building hashes</title>
	<atom:link href="http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/</link>
	<description>WordPress, web development, and world domination.</description>
	<lastBuildDate>Sat, 11 Feb 2012 20:29:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Carl Williams</title>
		<link>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/#comment-171917</link>
		<dc:creator>Carl Williams</dc:creator>
		<pubDate>Mon, 09 Aug 2010 18:42:09 +0000</pubDate>
		<guid isPermaLink="false">http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes#comment-171917</guid>
		<description>We recently posted an interview with some Perl experts at http://www.odinjobs.com/blogs/careers/entry/the_jewel_of_programming_perl</description>
		<content:encoded><![CDATA[<p>We recently posted an interview with some Perl experts at <a href="http://www.odinjobs.com/blogs/careers/entry/the_jewel_of_programming_perl" rel="nofollow">http://www.odinjobs.com/blogs/careers/entry/the_jewel_of_programming_perl</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dougal</title>
		<link>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/#comment-158708</link>
		<dc:creator>Dougal</dc:creator>
		<pubDate>Fri, 22 Jun 2007 13:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes#comment-158708</guid>
		<description>Hey, Matt! Long time no see!

I thought about using &lt;code&gt;map&lt;/code&gt;, but I was mainly illustrating the evolution of the refactoring that I actually did. Plus, the &lt;code&gt;map&lt;/code&gt; method isn&#039;t as clear or elegant, at least to my eyes (except for maybe your third example). 

And yes, I use a lot of hashrefs for building complex data structures. Hashrefs -- they&#039;re what&#039;s for dinner!
</description>
		<content:encoded><![CDATA[<p>Hey, Matt! Long time no see!</p>
<p>I thought about using <code>map</code>, but I was mainly illustrating the evolution of the refactoring that I actually did. Plus, the <code>map</code> method isn&#8217;t as clear or elegant, at least to my eyes (except for maybe your third example). </p>
<p>And yes, I use a lot of hashrefs for building complex data structures. Hashrefs &#8212; they&#8217;re what&#8217;s for dinner!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt M.</title>
		<link>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/#comment-158703</link>
		<dc:creator>Matt M.</dc:creator>
		<pubDate>Thu, 21 Jun 2007 21:11:28 +0000</pubDate>
		<guid isPermaLink="false">http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes#comment-158703</guid>
		<description>I just thought I&#039;d throw in a couple more ways to tackle things like this:


&lt;blockquote&gt;
&lt;code&gt;
{
my ($foo,$bar,$baz) = (&#039;foo val&#039;,&#039;bar val&#039;,&#039;baz val&#039;);

my @keys = qw/foo bar baz/;
my @values = ($foo,$bar,$baz);

# You can use map like the foreach
my %hash = map { $keys[$_] =&gt; $values[$_] } 0 .. $#keys;
my %hash = map { $keys[$_] =&gt; shift @values } 0 .. $#keys;
my %hash = map { $_ =&gt; shift @values } @keys;
my %hash = map { $_ =&gt; shift @values } qw/foo bar baz/;

# I tend to use hashrefs for passing stuff around
my $hash = {&#039;foo&#039;=&gt;$foo,&#039;bar&#039;=&gt;$bar,&#039;baz&#039;=&gt;$baz};
print $hash-&gt;{&#039;foo&#039;};

# Plus with hashrefs you can make them really complex and 
# still return them from a sub

}
&lt;/code&gt;
&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>I just thought I&#8217;d throw in a couple more ways to tackle things like this:</p>
<blockquote><p>
<code><br />
{<br />
my ($foo,$bar,$baz) = ('foo val','bar val','baz val');</p>
<p>my @keys = qw/foo bar baz/;<br />
my @values = ($foo,$bar,$baz);</p>
<p># You can use map like the foreach<br />
my %hash = map { $keys[$_] =&gt; $values[$_] } 0 .. $#keys;<br />
my %hash = map { $keys[$_] =&gt; shift @values } 0 .. $#keys;<br />
my %hash = map { $_ =&gt; shift @values } @keys;<br />
my %hash = map { $_ =&gt; shift @values } qw/foo bar baz/;</p>
<p># I tend to use hashrefs for passing stuff around<br />
my $hash = {'foo'=&gt;$foo,'bar'=&gt;$bar,'baz'=&gt;$baz};<br />
print $hash-&gt;{'foo'};</p>
<p># Plus with hashrefs you can make them really complex and<br />
# still return them from a sub</p>
<p>}<br />
</code>
</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dougal</title>
		<link>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/#comment-158702</link>
		<dc:creator>Dougal</dc:creator>
		<pubDate>Thu, 21 Jun 2007 21:08:06 +0000</pubDate>
		<guid isPermaLink="false">http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes#comment-158702</guid>
		<description>Now, now, let&#039;s not turn this into a religious discussion :)

However, I &lt;em&gt;have&lt;/em&gt; been kicking around some ideas for a post about OOP zealotry...</description>
		<content:encoded><![CDATA[<p>Now, now, let&#8217;s not turn this into a religious discussion <img src='http://dougal.gunters.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>However, I <em>have</em> been kicking around some ideas for a post about <acronym title='Object Oriented Programming'><span class='caps'>OOP</span></acronym> zealotry&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: talboito</title>
		<link>http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes/#comment-158694</link>
		<dc:creator>talboito</dc:creator>
		<pubDate>Thu, 21 Jun 2007 15:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://dougal.gunters.org/blog/2007/06/21/perl-geekery-building-hashes#comment-158694</guid>
		<description>Lisp.</description>
		<content:encoded><![CDATA[<p>Lisp.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Served from: dougal.gunters.org @ 2012-02-12 00:30:21 by W3 Total Cache -->
