On Wed, 1 Aug 2007, amiribarksdale wrote: > Timothy: > > Thank you for your response. As you can probably tell from the structure of > my loop, I am by no means a Perl professional or expert--could you please > possibly explain to me what is going on in the first loop you post? I can't > quite unpack it. I understand that you're adding some sort of index to each > file's fields, but it's murky. > > If you don't have the time to do that, could you perhaps point me somewhere > where I can read about this sort of algorithm?
I create a hash of hashes. >> $num = ($basekey !~ s/-(\d+)$//) ? 1 : $1; !~ means that the following regular expression is performed on $basekey. See "man perlre" for details. If the regular expression doesn't happen, then $num is set to 1, otherwise it's set to the part that matches inside the first set of parentheses. Basically, $num is the number of the file, and $basekey is the name of the arg with the number stripped off. >> $bighash->{$num}->{$basekey} = $ARGS{$key}; This makes a hash that looks like this: ------------------- $bighash = { 1 => { file => 'filename.txt', title => 'This is a title', ... }, 2 => { file => 'anotherfilename.txt', title => 'Another title', ... }, ... }; ------------------- Of course, you have to fill in the ... yourself. If you want to access things in $bighash, use $filename = $bighash->{1}->{file}; ...or something like that. You should be able to figure the whole thing out by looking at: man perlre man perllol Hope this helps. --------------------------------------------------------------------- | Name: Tim Nelson | Because the Creator is, | | E-mail: [EMAIL PROTECTED] | I am | --------------------------------------------------------------------- ----BEGIN GEEK CODE BLOCK---- Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y- -----END GEEK CODE BLOCK----- ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users