Hi monks..I have this script which reads i/p file line by line into variable $p, manipulates in a way it becomes a hash reference.. but when I print the $p it prints the manipulated line not something like HASH(0x1e0e9b8) (means it isn't a hash ref. just a normal variable... below is my script..
$line = "cksjdcdbsdcnusageControlAccum:S551(!{\!reportingGroups\!:[{\!
+absoluteAccumulated\!:{\!counters\!:[{\!bidirVolume\!:306490319,\!nam
+e\!:\!base\!}],\!expiryDate\!:{\!volume\!:\!24-07-2014T00:00:00\!},\!
+previousExpiryDate\!:{\!time\!:\!26-06-2014T00:00:00\!,\!volume\!:\!2
+6-06-2014T00:00:00\!},\!reportingLevel\!:\!totalTraffic\!,\!resetPeri
+od\!:{\!volume\!:\!28 days\!}},\!name\!:\!110\!,\!restartInfo\!:\!26-
+06-2014T00:00:00\!,\!selected\!:\!yes\!,\!subscriberGroupName\!:\!GJ_
+FUP_3GEXP_125MB_28\!,\!subscriptionDate\!:\!26-06-2014T00:00:00\!,\!v
+alidityTime\!:3600}],\!version\!:\!2.1\!}!)";
$line =~s/\\//g;
if ( $line =~ /usageControlAccum:(\w+)\(!(.*)!\)/ ) {
$p=$2;
$p=~s/:\{/ => {/g;
$p=~s/:\[/ => [/g;
$p=~s/!/\'/g;
$p=~s/\':/\'=>/g;
}
print $p;
ouput of which is
{'reportingGroups' => [{'absoluteAccumulated' => {'counters' => [{'bid
+irVolume'=>306490319,'name'=>'base'}],'expiryDate' => {'volume'=>'24-
+07-2014T00:00:00'},'previousExpiryDate' => {'time'=>'26-06-2014T00:00
+:00','volume'=>'26-06-2014T00:00:00'},'reportingLevel'=>'totalTraffic
+','resetPeriod' => {'volume'=>'28 days'}},'name'=>'110','restartInfo'
+=>'26-06-2014T00:00:00','selected'=>'yes','subscriberGroupName'=>'GJ_
+FUP_3GEXP_125MB_28','subscriptionDate'=>'26-06-2014T00:00:00','validi
+tyTime'=>3600}],'version'=>'2.1'}
now if I assign the above output value directly to any variable & then print it..it is considering it like a hash ref but not in this case...pls help..thanks