Working with lists in Perl -
I have two lists A and B:
a = ('Church. N.01 ',' Church.N.02 ',' Church_ServicesN.01 ',' Church.N.04 ') B = (' Temple N.01 ',' Temple N. 02 ',' Temple . N.03 ',' synagogue.n.01 ') I want to find a connection between a and b members using get_relatedness (arg1, arg2). How can I work in A and B in Perl, so that I pass all the possible combinations between Nested and A for two ends in Perl.
Please help me solve it because I am new to Perl
My @ A = ('Church.N.01', 'Church.N. 02', 'church_service.n.01', 'church.n.04'); My @ B = ('Temple N.01', 'Temple N. 02', 'Temple N. 03', 'Aradhnala N.01'); Use data: Dumper; Print dumper [get_relatedness (\ @ a, \ @b)]; Sub get_relationness {my ($ c, $ d) = @_; Return map {my $ t = $ _; Map [$ t, $ _], @ $ d} @ $ c; } output
$ VAR1 = [['church.n.01', 'temple.n.01'], ['church.n .01 ',' Temple. N. 02 '], [' Church.N.01 ',' Temple ' N. 03 '], [' Church N.01 ',' The Synagogue ' N.01 '], [' Church N. 02 ',' Temple N.01 '], [' Church. N. 02 ',' Temple. N. 02 '], [' Church. N. 02 ',' Temple. N. 03 '], [' Church. N. 02 ',' The synagogue. N.01 '], [' Church_services.N.01 ',' Temple N.01 '], [' Church_services.N.01 ',' Temple. N.02 '], [' Church_services.n.01 ',' Temple. N.01 '], [' Church_services.N.01 ',' Anacagogue N.01 '], [' Church. En 0.04 ',' Temple. N.01 '], [' Church. N. 04 ',' Temple. N. 02 '], [' Church. N. 04 ',' Temple. N. 03 '], [' Church. N. 04 ',' Aragigram N.01 ']]];
Comments
Post a Comment