in reply to Re: printing Hash
in thread printing Hash

Hi
In the code that you suggested, I HAVE to include the : for keys %{$mappings{$key}}; at the end of print statement.
I did this:
for my $key (keys %mappings) { print "$key - $mappings{$key}{$_} -> $_\n" for keys %{$ma +ppings{$key}} if ($mappings{$key}{$_} > 1); }
But the code still doesn't work.
The error message is:
syntax error at test.pl line 33, near "} if"

Thanks

Replies are listed 'Best First'.
Re^3: printing Hash
by bart (Canon) on Mar 25, 2006 at 16:56 UTC
    You can't put two "modifiers" in a single statement. That's what you're trying to do, and that's what perlsyn says you can't do — unfortunately.
    Any simple statement may optionally be followed by a SINGLE modifier, just before the terminating semicolon (or block ending).
    I didn't even need to stress the word "single" myself, it's written like that in the docs.
      Thanks man,
      Is it possible to put if statement somewhere before or after the print statement?

      Thanks