[lug] perl hash and array assignments in a loop

Jeffrey Haemer jeffrey.haemer at gmail.com
Fri Nov 16 17:15:30 MST 2007


Karl,

I think I'm already using one of your constructs


Nope, you're not.  That's why I gave you a working code sample that you
could cut, paste onto the command line, and see work.


> This just returns the array index count.
>
> print "dateinfo is :" .  @{$report{$id}{$dateinfo}} . "\n";
>

Correct.  Pulling the array out of the quotes won't work.


>  I'd like to just be able to do a quick debug print to see what's in each
> record
>

You betcha.  I try to develop and test constructs as command-line one-liners
because I like quick feedback.
Of course, if I stopped making mistakes, I wouldn't need to, but I'm having
trouble with that.

 I'm starting to gather the whole scalar only concept of perl.


Perl isn't scalar-only.

  it's rather hard to read programs with these
> complex data structures.


Perl gives you a lot of flexibility of expression, which was what I was
trying to illustrate by including both a hard-to-read and an easier-to-read
form.  Looks like I didn't do a very good job. :-)

Perl's not for everybody or everything; however, I did, at least, want to
make sure you'd gotten what I sent because I'd thought it addressed and
solved the problems you were asking about.

-- 
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell]
http://goyishekop.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20071116/50232d43/attachment.html>


More information about the LUG mailing list