in reply to Re^2: Module constant and constants in Hashes
in thread Module constant and constants in Hashes
#!/usr/bin/perl use warnings; use strict; #But I want to have something like: #0 = Zero #1 = One #2 = Three my %hash = ( 'NULL' => "Zero", 'EINS' => "One", 'ZWEI' => "Two", ); my %trans_hash =( 'NULL' => 0, 'EINS' => 1, 'ZWEI' => 2, ); foreach (sort keys %hash ) { print "$trans_hash{$_} = $hash{$_}\n"; }
|
|---|