Hi!

You can use say instead of print (with use v5.10 as minimum) to avoid this
strange behaviour.

use v5.10;
say %hash;

but output still be ugly - all keys and values concatenates withoud
delimeter.

if you want to dump your hash for debugging purpose, module Data::Dumper is
a great choice.

use Data::Dumper;
print Dumper \%hash;

And last, you get output '2/8' because when you concatenate %hash with
string, perl evaluates hash as scalar. More details you can find in that
stackoverflow question
http://stackoverflow.com/questions/7427381/what-do-you-get-if-you-evaluate-a-hash-in-scalar-context

сб, 13 июня 2015 г. в 19:48, Raj Barath <barat...@live.com>:

> You can go over the hash using for loop like
>
> for ( keys %hash ){
>       print $_ => $hash{$_}. "\n";
> }
>  On Jun 13, 2015 1:40 PM, "rakesh sharma" <rakeshsharm...@hotmail.com>
> wrote:
>
>> Hi
>>
>> I am printing a hash but I tried to concatenate the new line operator and
>> I am getting 2/8 as output;
>>
>> print %hash."\n";
>>
>> output is 2/8. I am not able to make the output. 2 could be the items in
>> the hash, which in my case was 2.
>> Any inputs?
>>
>> thanks
>> rakesh
>>
>

Reply via email to