Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Printing an Hash

by Rudolf (Pilgrim)
on Aug 01, 2012 at 15:37 UTC ( #984818=note: print w/replies, xml ) Need Help??

in reply to Printing an Hash

This should keep all of your indentation, though Im not aware of how you want it printed out, so I just put each key and value on a newline

use v5.14; my %hash = (' key' => 'value ',"\tkey2" => "value2\t"); open(FILE,'>>','filename') or die "$!"; while ( my($key, $value ) = each(%hash)){ print "$key\n$value\n"; print FILE "$key\n$value\n"; } close FILE;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984818]
[LanX]: OH
[LanX]: you are talking about signatures?
[GotToBTru]: yes, it turns out I am
[LanX]: http://perldoc. html#Prototypes
[GotToBTru]: that page, strangely enough, never mentions that construct
[LanX]: ; is for optional prototypes
[LanX]: & is codeblock @ array
[GotToBTru]: okay, that is there in the text, not in literal use in any of the examples
[GotToBTru]: the text suggest it is redundant before @
[LanX]: propably ... I also notice new stuff

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2017-01-18 21:14 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (164 votes). Check out past polls.