<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=us-ascii" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
All,<br>
<br>
Hans, that deref was the problem, thanks. Verbosity tends to be a
holdover from when I was less secure in my Pearl coding and wanted to
know exactly what I did. I refactor towards verbosity when I run into
problems, which in this case didn't actually help solve anything. I was
actually using the following when i went to test and noticed the issue:<br>
<br>
push (@{$newBoxNameH{$newBoxName}}, $newJobName);<br>
<br>
This replaced that whole code snippet in B.<br>
<br>
Shlomi, thanks for the tips. The Code in snippet A was from over a year
ago, before I started getting serious with Pearl and learned about how
to handle complex data structure and dereferencing. I know I need to go
back and refactor the sub that A came from, and one day as God is my
witness I will ;) As always, time is the issue.<br>
<br>
The variable names aren't meant to be Hungarian, just simply how I
started with Pearl and identifying an array from a hash, etc. Now it's
just laziness as those names pop into my head when thinking of new
variables. I do like my variables to be somewhat related to the data
they contain, but it's an evolving standard in my head.<br>
<br>
Again, thanks all for the help and sorry for the double post.<br>
<br>
Dan H.<br>
<br>
Hans Dieter Pearcey wrote:
<blockquote cite="mid:1258563940-sup-2408@glaive" type="cite">
  <pre wrap="">Excerpts from Daniel Herrington's message of Wed Nov 18 10:12:07 -0500 2009:
  </pre>
  <blockquote type="cite">
    <pre wrap="">       my @arJobNamesB = $ref_arJobNamesB;
    </pre>
  </blockquote>
  <pre wrap=""><!---->
I bet you meant '@$ref_arJobNamesB'.

Your code would probably be easier to skim for this kind of thing if it were
less verbose.  For example:

  </pre>
  <blockquote type="cite">
    <pre wrap="">           if ($newBoxNameH{$newBoxName}) {
               my $ref_arJobNames = $newBoxNameH{$newBoxName};
               my @arJobNames = @$ref_arJobNames;
               push (@arJobNames,$newJobName);
               $newBoxNameH{$newBoxName} = \@arJobNames;
           } else {
               my @arJobNames;
               push (@arJobNames,$newJobName);
               $newBoxNameH{$newBoxName} = \@arJobNames;
           }
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  my @foo;
  push @foo, $x;
  $thing = \@foo;

can be much more easily written as

  $thing = [ $x ];

In fact, the whole conditional I quoted above could be one line.

  push @{ $newBoxNameH{$newBoxName} }, $newJobName;

Perl will automatically turn the nonexistent hash element into an array
reference for you.  If this is too magical for your taste, default it to an
empty arrayref first:

  $newBoxNameH{$newBoxName} ||= [];

hdp.
_______________________________________________
Pdx-pm-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Pdx-pm-list@pm.org">Pdx-pm-list@pm.org</a>
<a class="moz-txt-link-freetext" href="http://mail.pm.org/mailman/listinfo/pdx-pm-list">http://mail.pm.org/mailman/listinfo/pdx-pm-list</a>
  </pre>
</blockquote>
</body>
</html>