{ my $hash_ref; BEGIN { while (defined (my $line = )){ chomp $line; my ($str, $num) = split /\|/, $line; $hash_ref->{$str} = $num; } } sub get_number{ my ($num) = @_; return $hash_ref->{$num}; } }