<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: DWIM means do what I mean, dammit!</title>
	<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit/</link>
	<description>Comments on Ask MetaFilter post DWIM means do what I mean, dammit!</description>
	<pubDate>Thu, 26 Mar 2009 22:06:37 -0800</pubDate>
	<lastBuildDate>Thu, 26 Mar 2009 22:06:37 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: DWIM means do what I mean, dammit!</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit</link>	
		<description>Perlfilter: I&apos;m having problems iterating over and testing for keys within a hash of hashes. &lt;br /&gt;&lt;br /&gt; Example code (apologies for the poor layout):&lt;br&gt;
&lt;br&gt;
&lt;code&gt;use strict;&lt;br&gt;
&lt;br&gt;
my %h = ( apples  =&amp;gt; {&lt;br&gt;
                        grannysmith =&amp;gt; 5,&lt;br&gt;
                        reddelicious =&amp;gt; 3&lt;br&gt;
                     },&lt;br&gt;
          oranges =&amp;gt; 2,&lt;br&gt;
          pears   =&amp;gt; 3 );&lt;br&gt;
&lt;br&gt;
print &quot;$_\n&quot; for keys %h;&lt;br&gt;
&lt;br&gt;
# problem 1&lt;br&gt;
print &quot;$_\n&quot; for keys %{%h-&amp;gt;{apples}}; # Warning: Using a hash as a reference is deprecated.&lt;br&gt;
&lt;br&gt;
# workaround&lt;br&gt;
my $h_ref = \%h;&lt;br&gt;
print &quot;$_\n&quot; for keys %{$h_ref-&amp;gt;{apples}};&lt;br&gt;
&lt;br&gt;
# problem 2&lt;br&gt;
for my $fruit ( keys %{$h_ref-&amp;gt;{apples}} ) {&lt;br&gt;
    if ( exists $fruit-&amp;gt;{reddelicious} ) {  # Error: Can&apos;t use string (&quot;grannysmith&quot;) as a HASH ref while &quot;strict refs&quot; in use at test.pl line xx&lt;br&gt;
        print &quot;Found red delicious key\n&quot;;&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
The code flagged as &lt;strong&gt;problem 1&lt;/strong&gt; returns &lt;br&gt;
grannysmith&lt;br&gt;
reddelicious&lt;br&gt;
&lt;br&gt;
but with a warning: &quot;Using a hash as a reference is deprecated.&quot;  What would the undeprecated form be?  I can make it work without the warning using the code flagged with &lt;strong&gt;workaround&lt;/strong&gt;, but I don&apos;t see why I should have to create an extra reference if I can avoid it.&lt;br&gt;
&lt;br&gt;
The code at &lt;strong&gt;problem 2&lt;/strong&gt; produces a flat-out error: &quot;Can&apos;t use string (&quot;grannysmith&quot;) as a HASH ref while &quot;strict refs&quot; in use at test.pl line xx&quot;.  What it should do (what I want it to do) is print &quot;Found red delicious key&quot;.  What am I doing wrong?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2009:site.117863</guid>
		<pubDate>Thu, 26 Mar 2009 22:00:02 -0800</pubDate>
		<dc:creator>Ritchie</dc:creator>
		
			<category>perl</category>
		
			<category>hashref</category>
		
			<category>hoh</category>
		
			<category>resolved</category>
		
	</item> <item>
		<title>By: suedehead</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688573</link>	
		<description>Does this work?&lt;br&gt;
&lt;pre&gt;print &quot;$_\n&quot; for keys %{ $h{apples} }&lt;/pre&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688573</guid>
		<pubDate>Thu, 26 Mar 2009 22:06:37 -0800</pubDate>
		<dc:creator>suedehead</dc:creator>
	</item><item>
		<title>By: suedehead</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688575</link>	
		<description>Er, also, for problem 2, $fruit will be a string for each iteration of the loop, since &apos;keys&apos; will return a string for each key of the hash ---- yet you&apos;re treating it like it&apos;ll be a hash reference.&lt;br&gt;
&lt;br&gt;
I&apos;m not sure what you&apos;re trying to do but I&apos;m assuming you&apos;re trying to iterate within the keys of the hash-within-the-hash (within the apples hash) and am trying to find whether or not &apos;reddelicious&apos; exists?&lt;br&gt;
&lt;br&gt;
Then do either: &lt;br&gt;
&lt;pre&gt;for my $fruit ( keys %{$h{apples}} ) {&lt;br&gt;
if ($fruit eq &quot;reddelicious&quot; ) { print &quot;Found red delicious key\n&quot;;}&lt;br&gt;
}&lt;/pre&gt;&lt;br&gt;
or&lt;br&gt;
&lt;pr&gt;if (exists $h{apples}{reddelicious} ) {&lt;br&gt;
print &quot;Found red delicious key\n&quot;;&lt;br&gt;
}&lt;/pr&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688575</guid>
		<pubDate>Thu, 26 Mar 2009 22:18:16 -0800</pubDate>
		<dc:creator>suedehead</dc:creator>
	</item><item>
		<title>By: Blazecock Pileon</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688608</link>	
		<description>What I might do, using Perl&apos;s unique &lt;a href=&quot;http://en.wikipedia.org/wiki/Autovivification&quot;&gt;autovivification&lt;/a&gt; feature:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;#!/usr/bin/perl -w&lt;br&gt;
&lt;br&gt;
use strict;&lt;br&gt;
use warnings;&lt;br&gt;
&lt;br&gt;
my $h;&lt;br&gt;
&lt;br&gt;
$h-&amp;gt;{apples}-&amp;gt;{grannysmith} = 5;&lt;br&gt;
$h-&amp;gt;{apples}-&amp;gt;{reddelicious} = 5;&lt;br&gt;
$h-&amp;gt;{oranges} = 2;&lt;br&gt;
$h-&amp;gt;{pears} = 5;&lt;br&gt;
&lt;br&gt;
foreach my $fruitName (keys %{$h}) { &lt;br&gt;
&amp;nbsp;print &quot;Fruit: $fruitName\n&quot;; &lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
foreach my $appleName (keys %{$h-&amp;gt;{apples}}) { &lt;br&gt;
&amp;nbsp;print &quot;Apple name: $appleName\n&quot;; &lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
foreach my $fruitName (keys %{$h}) {&lt;br&gt;
&amp;nbsp;if ($fruitName =~ /apples/) { &lt;br&gt;
&amp;nbsp;&amp;nbsp;if (defined $h-&amp;gt;{$fruitName}-&amp;gt;{reddelicious}) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;print &quot;found red delicious apple\n&quot;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
exit 0;&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688608</guid>
		<pubDate>Thu, 26 Mar 2009 23:34:31 -0800</pubDate>
		<dc:creator>Blazecock Pileon</dc:creator>
	</item><item>
		<title>By: sbutler</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688617</link>	
		<description>First: &lt;pre&gt;print &quot;$_\n&quot; for keys %{&lt;i&gt;%h&lt;/i&gt;-&amp;gt;{apples}}; # Warning: Using a hash as a reference is deprecated.&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
Classic new person mistake :) See the &quot;%h&quot; I put in italics? You want &quot;$h&quot; instead. Reason: the signul -- @, %, $, or sometimes * -- in front determines what type of data you want &lt;em&gt;out&lt;/em&gt; of the evaluation of the expression. You want the scalar value out, so you need to use $. Consider these examples:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;%h = (a =&amp;gt; &apos;apple&apos;, b =&amp;gt; &apos;banana&apos;, c =&amp;gt; &apos;corn&apos;);&lt;br&gt;
%h; # evaluates to the list (&apos;a&apos;, &apos;apple&apos;, &apos;b&apos;, &apos;banana&apos;, &apos;c&apos;, &apos;corn&apos;)&lt;br&gt;
    # although not specifically in that order&lt;br&gt;
@h{&apos;a&apos;, &apos;b&apos;}; # evaluates to the list (&apos;apple&apos;, &apos;banana&apos;)&lt;br&gt;
$h{&apos;a&apos;}; # evaluates to the scalar &apos;apple&apos;&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
Note how I used $h{&apos;a&apos;} and not $h-&amp;gt;{&apos;a&apos;}. That&apos;s because h is a &lt;b&gt;hash&lt;/b&gt;, not a &lt;b&gt;reference to a hash&lt;/b&gt;. You made that mistake too.&lt;br&gt;
&lt;br&gt;
Second: &lt;pre&gt;for my $fruit ( keys %{$h_ref-&amp;gt;{apples}} ) { if ( exists $fruit-&amp;amp;gt{reddelicious} ) { print &quot;Found red delicious key\n&quot;; } }&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
Think for a minute about what $fruit is. It&apos;s your hash &lt;em&gt;key&lt;/em&gt;, which is a scalar string. It makes no sense to dereference a scalar string as a hash, which is exactly what the error told you. It&apos;s the same as writing &quot;reddelicious&quot;-&amp;gt;{reddelicious}. I don&apos;t know what you&apos;re trying to do with this bit of code. If you want to see if there exists &apos;reddelicious&quot; key in &apos;apples&apos;, then this suffices:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;if (exists $h{&apos;apples&apos;}-&amp;gt;{&apos;reddelicious&apos;}) { ... }&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
Note the indirection operator on the SECOND part. That&apos;s because your first part is a HASH, which contains a HASH REFERENCE. If you want to find what fruit has a key &apos;reddelicious&apos;, then you do this:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;for my $fruit ( keys %h ) { if ( ref( $h{$fruit} ) eq &apos;HASH&apos;) &amp;amp;&amp;amp; exists $h{$fruit}-&amp;amp;gt{reddelicious} ) { print &quot;Found red delicious key\n&quot;; } }&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
You need to check with ref() the type of data in each key since your hash %h mixes scalars and hash references.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688617</guid>
		<pubDate>Fri, 27 Mar 2009 00:12:19 -0800</pubDate>
		<dc:creator>sbutler</dc:creator>
	</item><item>
		<title>By: Blazecock Pileon</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688618</link>	
		<description>References sound scary in Perl, but they get much easier to work with the more you use them with indirection arrow operations. A lot less guesswork and cleaner code.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688618</guid>
		<pubDate>Fri, 27 Mar 2009 00:15:46 -0800</pubDate>
		<dc:creator>Blazecock Pileon</dc:creator>
	</item><item>
		<title>By: sbutler</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688621</link>	
		<description>Let me say just a couple more things about perl variables that may help you here.&lt;br&gt;
&lt;br&gt;
#1: Consider this:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;my $foo = 1234;&lt;br&gt;
my @foo = (&apos;bar&apos;, &apos;baz&apos;);&lt;br&gt;
my %foo = (one =&amp;gt; 1, two =&amp;gt; 2, three =&amp;gt; 3, four =&amp;gt; 4);&lt;br&gt;
&lt;br&gt;
printf &quot;%s\n&quot;, $foo;&lt;br&gt;
printf &quot;%s\n&quot;, $foo[ 0 ];&lt;br&gt;
printf &quot;%s\n&quot;, $foo{ &apos;three&apos; };&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
What is the output? Better question is, how does perl tell the difference between $foo, @foo, and %foo in those print statements?!?&lt;br&gt;
&lt;br&gt;
The answer is &lt;em&gt;not&lt;/em&gt; the signul out front! Noticed I used the same one for all three prints because in all three cases I wanted a &lt;em&gt;scalar&lt;/em&gt; out of the expression. The way perl knows the difference is by &lt;strong&gt;how the variable is used&lt;/strong&gt;!&lt;br&gt;
&lt;br&gt;
It knows the first $foo evaluates to 1234 because it is just plain.&lt;br&gt;
&lt;br&gt;
It knows the second $foo[ 0 ] evaluates to &apos;bar&apos; because it has array index brackets after it.&lt;br&gt;
&lt;br&gt;
It knows the third $foo{ &apos;three&apos; } evaluates to 3 because it has the hash key lookup braces after it.&lt;br&gt;
&lt;br&gt;
#2: There is no way to express an immediate hash in perl. What do I mean by immediate? I mean an expression that all by itself, ignoring constants, evaluates to a hash. Your basic types are:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;# types of scalars&lt;br&gt;
1234;&lt;br&gt;
&apos;this is a string&apos;;&lt;br&gt;
&lt;br&gt;
# types of lists&lt;br&gt;
(1, 2, 3, 4);&lt;br&gt;
(&apos;foo&apos;, &apos;bar&apos;, &apos;baz&apos;);&lt;br&gt;
(a =&amp;gt; &apos;one&apos;, b =&amp;gt; &apos;two&apos;, c =&amp;gt; &apos;three&apos;);&lt;br&gt;
(&apos;a&apos;, &apos;one&apos;, &apos;b&apos;, &apos;two&apos;, &apos;c&apos;, &apos;three&apos;);&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
No hashes! You might be tempted to say that list #3 is a hash, but it&apos;s not. It&apos;s just a fancy way of writing exactly the same list #4. That is, &apos;=&amp;gt;&apos; in perl is almost exactly like &apos;,&apos; (except it always interprets its left hand side as a string, even when not quoted).&lt;br&gt;
&lt;br&gt;
There are also some types of scalars you run into all the time:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;# scalar reference&lt;br&gt;
\1234;&lt;br&gt;
\&apos;this is a string&apos;;&lt;br&gt;
&lt;br&gt;
# list reference&lt;br&gt;
[ 1, 2, 3, 4 ];&lt;br&gt;
[&apos;foo&apos;, &apos;bar&apos;, &apos;baz&apos;];&lt;br&gt;
[a =&amp;gt; &apos;one&apos;, b =&amp;gt; &apos;two&apos;, c =&amp;gt; &apos;three&apos;];&lt;br&gt;
[&apos;a&apos;, &apos;one&apos;, &apos;b&apos;, &apos;two&apos;, &apos;c&apos;, &apos;three&apos;];&lt;br&gt;
\@foo;&lt;br&gt;
&lt;br&gt;
# hash reference&lt;br&gt;
{a =&amp;gt; &apos;one&apos;, b =&amp;gt; &apos;two&apos;, c =&amp;gt; &apos;three&apos;};&lt;br&gt;
{&apos;a&apos;, &apos;one&apos;, &apos;b&apos;, &apos;two&apos;, &apos;c&apos;, &apos;three&apos;};&lt;br&gt;
\%foo;&lt;br&gt;
&lt;br&gt;
# subroutine reference&lt;br&gt;
sub { print &quot;test\n&quot;; }&lt;br&gt;
\&amp;foo;&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
But again, those are &lt;strong&gt;all&lt;/strong&gt; scalars. They just happen to be references to data of another type. And when you have a scalar that is a reference, that&apos;s when the indirection operator comes in, or sometimes you have two signuls together:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;$$scalarref; ${$scalarref};&lt;br&gt;
@$listref; @{$listref};&lt;br&gt;
%$hashref; %{$hashref};&lt;br&gt;
&amp;amp;$subref;&lt;/pre&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688621</guid>
		<pubDate>Fri, 27 Mar 2009 00:38:43 -0800</pubDate>
		<dc:creator>sbutler</dc:creator>
	</item><item>
		<title>By: singingfish</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688630</link>	
		<description>Usually you&apos;ll get a better response if you ask this type of question on  &lt;a href=&quot;http://perlmonks.org&quot;&gt;Perlmonks&lt;/a&gt; or on &lt;a href=&quot;&quot;&gt;Stack Overflow&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Meanwhile here&apos;s a diff that solves your problem for you.  I suggest that you read perldoc perlreftut a couple of times as you&apos;re still confused about perl references.  Also the book Perl Best Practices is brilliant for working out the right way to deal with references.  I can tell that  you&apos;re still confused rather than badly informed because it took me ages (5-10 minutes) to work out what you&apos;d done wrong.&lt;br&gt;
&lt;br&gt;
Also good to see you&apos;re using perl.  Stick with it, it reaps rewards (and for object orientated stuff, ignore all other advice and &lt;code&gt;use Moose;&lt;/code&gt;)&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;br&gt;
--- doit_orig.pl	2009-03-27 19:09:03.000000000 +1100&lt;br&gt;
+++ doit.pl	2009-03-27 19:25:04.000000000 +1100&lt;br&gt;
@@ -1,3 +1,5 @@&lt;br&gt;
+#!/usr/bin env perl&lt;br&gt;
+use warnings;&lt;br&gt;
 use strict;&lt;br&gt;
 &lt;br&gt;
 my %h = ( apples =&amp;gt; {&lt;br&gt;
@@ -10,15 +12,16 @@&lt;br&gt;
 print &quot;$_\n&quot; for keys %h;&lt;br&gt;
 &lt;br&gt;
 # problem 1&lt;br&gt;
-print &quot;$_\n&quot; for keys %{%h-&amp;gt;{apples}}; # Warning: Using a hash as a reference is deprecated.&lt;br&gt;
+print &quot;$_\n&quot; for keys %{ $h{apples} }; # fixed!&lt;br&gt;
 &lt;br&gt;
 # workaround&lt;br&gt;
 my $h_ref = \%h;&lt;br&gt;
 print &quot;$_\n&quot; for keys %{$h_ref-&amp;gt;{apples}};&lt;br&gt;
 &lt;br&gt;
 # problem 2&lt;br&gt;
+$DB::single=1;&lt;br&gt;
 for my $fruit ( keys %{$h_ref-&amp;gt;{apples}} ) {&lt;br&gt;
-if ( exists $fruit-&amp;gt;{reddelicious} ) { # Error: Can&apos;t use string (&quot;grannysmith&quot;) as a HASH ref while &quot;strict refs&quot; in use at test.pl line xx&lt;br&gt;
+if ( $fruit eq &apos;reddelicioius&apos; ) { # no warning now!&lt;br&gt;
 print &quot;Found red delicious key\n&quot;;&lt;br&gt;
 }&lt;br&gt;
 }&lt;br&gt;
&lt;/pre&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688630</guid>
		<pubDate>Fri, 27 Mar 2009 01:30:58 -0800</pubDate>
		<dc:creator>singingfish</dc:creator>
	</item><item>
		<title>By: singingfish</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688631</link>	
		<description>also you should indent properly.  Perl Best Practices is worth looking at for advice here too.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688631</guid>
		<pubDate>Fri, 27 Mar 2009 01:31:56 -0800</pubDate>
		<dc:creator>singingfish</dc:creator>
	</item><item>
		<title>By: scruss</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688639</link>	
		<description>I&apos;m a bit thick when it comes to data structures, so whenever I have trouble identifying structures, I just use &lt;a href=&quot;http://search.cpan.org/~ovid/Data-Dumper-Simple-0.11/lib/Data/Dumper/Simple.pm&quot;&gt;Data::Dumper::Simple&lt;/a&gt; and &lt;code&gt;Dumper&lt;/code&gt; the recalcitrant structure to stdout. Enlightenment follows (usually).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688639</guid>
		<pubDate>Fri, 27 Mar 2009 03:00:28 -0800</pubDate>
		<dc:creator>scruss</dc:creator>
	</item><item>
		<title>By: mohrr</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1688646</link>	
		<description>First, if all you&apos;re trying to do is print this out, use Data::Dumper or a related module.&lt;br&gt;
&lt;br&gt;
The larger problem seems to be that you&apos;re dealing with a data structure that mixes string scalars and references to hashes, and you&apos;re not sure how to deal with it.  I do this often, and provided an example here.&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;use strict;&lt;br&gt;
use warnings; # always use this&lt;br&gt;
&lt;br&gt;
my %h = (&lt;br&gt;
  apples =&amp;gt; {&lt;br&gt;
    grannysmith =&amp;gt; 5,&lt;br&gt;
    reddelicious =&amp;gt; 3&lt;br&gt;
  },&lt;br&gt;
  oranges =&amp;gt; 2,&lt;br&gt;
  pears =&amp;gt; 3 );&lt;br&gt;
&lt;br&gt;
for my $fruit ( keys %h )&lt;br&gt;
{&lt;br&gt;
  if ( ref $h{$key} eq &quot;&quot; )&lt;br&gt;
  {&lt;br&gt;
    print $h{$fruit}, &quot; &quot;, $fruit, &quot;\n&quot;;&lt;br&gt;
  }&lt;br&gt;
  elsif ( ref $h{$key} eq &quot;HASH&quot; )&lt;br&gt;
  {&lt;br&gt;
    for my $type ( keys %{$h{$key}} )&lt;br&gt;
    {&lt;br&gt;
      print $type, &quot; &quot;, $fruit, &quot; &quot;, $h{$fruit}-&amp;gt;{$type}, &quot;\n&quot;;&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
  else&lt;br&gt;
  {&lt;br&gt;
    print STDERR ref $h{$key}, &quot; references not permitted\n&quot;;&lt;br&gt;
    exit( -1 );&lt;br&gt;
  }&lt;br&gt;
}&lt;/pre&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1688646</guid>
		<pubDate>Fri, 27 Mar 2009 03:59:57 -0800</pubDate>
		<dc:creator>mohrr</dc:creator>
	</item><item>
		<title>By: singingfish</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1689328</link>	
		<description>Personaly I like the debugger for working out where I am in a data strucutre, hence why I had $DB:single=1 (force a breakpoint running under perl -d) in my diff.  You can use &quot;x $data&quot; to get a nice readable dump of the data structure.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1689328</guid>
		<pubDate>Fri, 27 Mar 2009 14:51:10 -0800</pubDate>
		<dc:creator>singingfish</dc:creator>
	</item><item>
		<title>By: Ritchie</title>
		<link>http://ask.metafilter.com/117863/DWIM-means-do-what-I-mean-dammit#1691278</link>	
		<description>Gah!  It was all so &lt;em&gt;obvious&lt;/em&gt; (in retrospect).&lt;br&gt;
&lt;br&gt;
I&apos;m coming back to perl after a long hiatus in which I&apos;ve been working with ksh and sql scripts, so I&apos;m rusty -- and I was never never much more than a perl beginner to start with.&lt;br&gt;
&lt;br&gt;
I posted this question on a Friday afternoon after I&apos;d spent most of the day wrestling with an issue I thought I understood.  I&apos;d re-read perlretut and flipped back and forth through the camel book to no avail.  I&apos;d searched perlmonks but couldn&apos;t seem to fix on the answer.&lt;br&gt;
&lt;br&gt;
In the end I was doing the stupidest thing possible - randomly swapping around sigils, braces, and indirection operators in a half-assed attempt at making something happen.  What was lacking was a clearer understanding, and I your answers have assisted greatly.  Also it&apos;s Monday, and I&apos;ve had coffee.&lt;br&gt;
&lt;br&gt;
For those interested, I&apos;m writing a script that builds special types of script for our BI server and then executes them - under Windows.  It reads in a config file (using Config::General) to determine what needs to be executed (and when, and how), and then builds the script and runs it at the appointed interval or after the nominated event occurs.&lt;br&gt;
&lt;br&gt;
It&apos;s a biggish project that goes a bit beyond what I currently know of perl (as you&apos;ve already seen), but I figure the best way to learn something new is to bite off more than I can chew and then chew as fast as possible.&lt;br&gt;
&lt;br&gt;
I&apos;ve already used Data::Dumper to make sure that my config file loads up properly and everything is where I thought it would be.  Config::General parses your config file into a hash (not a hashref).  The internal structure of the hash depends entirely on what was in your config, but in my case contains ordinary scalar values, references to hashes, and references to arrays.&lt;br&gt;
&lt;br&gt;
Someone referenced &lt;em&gt;Perl Best Practices&lt;/em&gt; - I have read parts of that book, and usually my code is fairly cleanly laid out (to my eyes at least).  I just didn&apos;t know how to get the indenting working within the &amp;lt;code&amp;gt; tag in my post.  When I was at Monash I snuck into a few of Damian Conway&apos;s lectures.  He&apos;s quite an amazing guy.&lt;br&gt;
&lt;br&gt;
Thanks again to everyone who replied.  You are a pack of magnificent bastards.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117863-1691278</guid>
		<pubDate>Sun, 29 Mar 2009 16:33:05 -0800</pubDate>
		<dc:creator>Ritchie</dc:creator>
	</item>
	</channel>
</rss>
