Simply put can anyone tell me why this:
#!/usr/bin/perl use warnings; use strict; use Win32::TieRegistry (Delimiter => "/"); use Data::Dumper; my $val; my $val2; my @set = (1,2); my $watchcode = 0; my $error; unless (defined($ARGV[0])){ foreach $val (keys %{ $Registry->{"Classes/"} }){ if ($val =~ /^[.]/) { my %RegHash = %{ $Registry->{"Classes/$val"} }; Dumper %RegHash = $error; while (@set = 2){ @set = each %RegHash or die "failure to read registry +: $! \nlast contents of Registry Hash = $error \n"; if ($set[1] eq "/"){ print "$val = $set[0]\n"; $watchcode = 1; } } if ($watchcode == 0){ die "failure to recognise association list: $!"; } } } };

doesn't work...

it's supposed to be part of a direct lookalike of the plain 'assoc' utility in Windows 2000/XP which, when invoked on it's own, lists the extensions and the associated filetypes on the system.

what actually happens when I exectute is this:

Odd number of elements in hash assignment at E:\workspaces\perl\asoc.p +l line 17. Use of uninitialized value in list assignment at E:\workspaces\perl\as +oc.pl line 17. Use of uninitialized value in string eq at E:\workspaces\perl\asoc.pl +line 20. Use of uninitialized value in concatenation (.) or string at E:\worksp +aces\perl\ asoc.pl line 19. failure to read registry: last contents of Registry Hash =
which suggests that the $registry reference isn't behaving as I expect it too when it's fed to the 'each' function, however this is strange, because it works fine with 'keys' and 'values'... except when i try to get it too read the default value under the key "/".

*sigh* i'm beginning to understand where perl gets it's name from, I must seriously be missing something about references or objects or TiedHashes excetera

I also think i might be missing something about how the TieRegistry module does work (or doesn't as the case may be)

In reply to Confused: Hashrefs in TieRegistry by Maze

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.