axtens wrote:
G'day everyone

I'm confused. I'm trying to make use of Tie::Hash::TwoWay to give me
access to a dictionary of word <=> misspelling. Has anyone got any
idea how I would use TwoWay for this? Nothing I do seems to work.

  my $secondary = $dict->{0};
  while ( ($k, $v) = ( each %$secondary ) ) {
      print $k . "\t" . $v . "\n";
  }

  my $primary = $dict->{1};
  while ( ($k, $v) = ( each %$primary ) ) {
      print $k . "\t" . $v . "\n";
  }

After sending my previous post it occurs to me that you may not realise
that the values of the tied hash are themselves hash references. Try a
loop like this:

  while (my ($k, $v) = each %$secondary) {
    printf "%s => (%s)\n", $k, join ' ', keys %$v;
  }

is that closer to what you expect?

Oh, and please

  use strict;
  use warnings;

at the start of your code. Thanks.

Rob



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to