I've two string like follows in PERL script.
$labels = "firstname|lastname|email";
$values = 'krishna|mohan|[email protected]';
Now I would like to construct a JSON fromat from those two srings. I need to split (explode) both the strings base on | (pipe) symbol and construct a JSON format like follows
{"firstname":"krishna","lastname":"mohan","email":"[email protected]"}
How can I achieve this? Any Ideas would be much appreciated.
@j{ split /\|/, $labels } = split /\|/, $values;