<?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"
	>
<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>Random musings of a Southern geek</description>
	<pubDate>Mon, 08 Sep 2008 01:43:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2-beta</generator>
		<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'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're what'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'd throw in a couple more ways to tackle things like this:


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

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

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

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

# 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 = {&#8217;foo&#8217;=&gt;$foo,&#8217;bar&#8217;=&gt;$bar,&#8217;baz&#8217;=&gt;$baz};<br />
print $hash-&gt;{&#8217;foo&#8217;};</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'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>
