The ouput is pasted below-use strict; use warnings; use JSON; open(FILE, ">>bookmarkmirror.json"); my %bookmarks; my @charset = ('1','0'); my @charset2 =(''); my @charset3 =(''); my @charset4 = (('A'..'Z'), ('a'..'z')); my @charset5 = (('A'..'Z'), ('a'..'z')); my @charset6 = ('1' .. '1000'); my @charset7 =('http://www.','https://www.'); my @charset8=('.com','.co','.in','.info','.org','.net','.biz','.us','. +me','.mobi','.co.in','.firm.in','.gen.in','.ind.in','.net.in','.org.i +n','.tv','.ag','.am','.asia','.at','.be','.bz','.ca','.cc','.co.nz',' +.co.uk','.com.ag','.com.au','.com.br','.com.bz','.com.co','.com.es',' +.com.mx','.com.pe','.com.so','.com.tw','.cz','.de','.es','.eu','.fm', +'.fr','.gs','.idv.tw','.it','.jobs','.jp','.la','.me.uk','.ms','.mx', +'.net.ag','.net.au','.net.br','.net.bz','.net.co','.net.nz','.net.pe' +,'.net.so','.nl','.nom.co','.nom.es','.nom.pe','.org.ag','.org.au','. +org.es','.org.nz','.org.pe','.org.so','.org.tw','.org.uk','.pe','.se' +,'.so','.tk','.tw','.ws','.xxx'); my $i=0; print "Enter the limit : "; chomp(my $lim = <STDIN>); while ( $lim-- ) { push @{$bookmarks{browserBookMarksData}}, { bookMark => $charset[ rand(@charset) ], created => $charset2[ rand(@charset2) ], date => $charset3[ rand(@charset3) ], title => join '', @charset4[map {int rand @charset4} (1..8) +], url => join '', @charset5[map {int rand @charset5} (1..8) +], visits => $charset6[rand(@charset6) ], }; } print FILE to_json \%bookmarks; close(FILE);
{"browserBookMarksData":{"created":"","bookMark":"1","date":"","title":"YvJzwzBRurlOgWzGkJEvisits843"},{"created":"","bookMark":"1","date":"","title":"COubQkTRurlfVbzdDGUvisits393"}}
Now the problem is that the url and visit fields get merged .There is no comma seperation between there the url and the visits fields and also how to join the three character set ie. charset4 ,charset7 and charset 8 to make the url field.In reply to Re^2: Bug in my perl script
by rahul_lfo
in thread Perl Script to create jsons(Issue with comma)
by rahul_lfo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |