in reply to print hash into scalar

#!perl -w use strict; use Data::Dumper; my %addrRow = ( 'name' => 'Billy', 'email' => '', 'city' => 'NY', 'country' => 'USA' ); $Data::Dumper::Indent = 0; $Data::Dumper::Purity = 1; my $scalar = Data::Dumper->Dump( [\%addrRow], ['*addrRow'] );

$scalar now contains the hash. You can print() the value to see the hash, print the value to a file and later do() the file to recreate the hash, or use an eval() on the scalar... You can do quite a bit :) Sadly, I used to use this as a database, until I found out that the pages load quite slowly when multiple requests are waiting for the release of a sequentially locked file while Data::Dumper does its job. Now I use MySQL for nearly everything.

Update: Just to add something so I don't get yelled at :) If you do indeed use Data::Dumper to save the hash to a file and then use do() to recreate the hash, you should most likely lock a sequential file to prevent damage to the data. Also, if you 'use strict' (which you should be), you will have to declare the hash via our() or use vars() before do()ing the file. Otherwise, strict will complain, etc etc.

eval reverse@{[lreP
=>q{ tsuJ\{qq},' rehtonA'
,q{\}rekcaH },' tnirp']}[1+1+