My first thought is "what are you trying to accomplish? "

Consider the following:

#!/usr/bin/perl -w ###################################################################### +## use strict; use Data::Dumper; my %hash=(); foreach my $i('a'...'g'){ foreach my $j('a'..'g'){ $hash{$i,$j}="-"; } } print Dumper(%hash);

When run produces:

$VAR1 = 'dd'; $VAR2 = '-'; $VAR3 = 'fb'; $VAR4 = '-'; $VAR5 = 'ab'; $VAR6 = '-'; $VAR7 = 'ge'; $VAR8 = '-'; $VAR9 = 'bd'; $VAR10 = '-'; $VAR11 = 'dc'; $VAR12 = '-'; $VAR13 = 'aa'; $VAR14 = '-'; $VAR15 = 'cc'; $VAR16 = '-'; $VAR17 = 'ae'; $VAR18 = '-'; $VAR19 = 'ba'; $VAR20 = '-'; $VAR21 = 'cb'; $VAR22 = '-'; $VAR23 = 'gb'; $VAR24 = '-'; $VAR25 = 'ef'; $VAR26 = '-'; $VAR27 = 'ea'; $VAR28 = '-'; $VAR29 = 'gd'; $VAR30 = '-'; $VAR31 = 'ec'; $VAR32 = '-'; $VAR33 = 'cg'; $VAR34 = '-'; $VAR35 = 'ad'; $VAR36 = '-'; $VAR37 = 'eg'; $VAR38 = '-'; $VAR39 = 'de'; $VAR40 = '-'; $VAR41 = 'fe'; $VAR42 = '-'; $VAR43 = 'fg'; $VAR44 = '-'; $VAR45 = 'dg'; $VAR46 = '-'; $VAR47 = 'cf'; $VAR48 = '-'; $VAR49 = 'bf'; $VAR50 = '-'; $VAR51 = 'ed'; $VAR52 = '-'; $VAR53 = 'ce'; $VAR54 = '-'; $VAR55 = 'ac'; $VAR56 = '-'; $VAR57 = 'gf'; $VAR58 = '-'; $VAR59 = 'bb'; $VAR60 = '-'; $VAR61 = 'db'; $VAR62 = '-'; $VAR63 = 'ee'; $VAR64 = '-'; $VAR65 = 'bc'; $VAR66 = '-'; $VAR67 = 'ga'; $VAR68 = '-'; $VAR69 = 'gc'; $VAR70 = '-'; $VAR71 = 'af'; $VAR72 = '-'; $VAR73 = 'fd'; $VAR74 = '-'; $VAR75 = 'gg'; $VAR76 = '-'; $VAR77 = 'fc'; $VAR78 = '-'; $VAR79 = 'ca'; $VAR80 = '-'; $VAR81 = 'ag'; $VAR82 = '-'; $VAR83 = 'be'; $VAR84 = '-'; $VAR85 = 'fa'; $VAR86 = '-'; $VAR87 = 'cd'; $VAR88 = '-'; $VAR89 = 'ff'; $VAR90 = '-'; $VAR91 = 'bg'; $VAR92 = '-'; $VAR93 = 'df'; $VAR94 = '-'; $VAR95 = 'da'; $VAR96 = '-'; $VAR97 = 'eb'; $VAR98 = '-';

Was this what you were after?

I noticed that GrandFather showed the other method. It is all in what you want to accomplish...


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Re: multi-dimensional hash by blue_cowdawg
in thread multi-dimensional hash by fionbarr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.