arrays - How can I iterate over multiple lists at the same time in Perl? -
I need to create a text file (aptest.s) which Ican to read in another Uses program I'm using Perl because I have a large list to work on. My code is as follows (which does not produce the desired output - shown after code and actual output) Any help would be appreciated.
#! / Usr / bin / perl -w chdir ("D: // Projects // SW Model ODME"); @ Link = ("319-116264 || 319-118664", "320-116380 || 320-116846", "321-119118 || 321-119119", "322-115298 || 322-119087"); @ Link1 = ("116264-319 || 118664-31 9", "116380-320 || 116846-320", "119118-321 || 119119-321", "115298-322 || 119087-322") ; Open (FSAS, "> Aptitude S"); Forex Currency $ link (@link) {foreach $ link1 (@ link1) {Print FSAS "Other Code \ n"; Print FSAS "PATHIGHT SELECTLINK = (link =". $ Link. "), VOL [2] = MW [1] \ n"; Print FSAS "PATFT SELECTLINK = (link =". $ Link1. "), VOL [3] = MW [2] \ n"; Print FSAS "Other Code \ n"; }} Actual output :
Other output pathhigh SELECTLINK = (link = 319-116264 || 319118664) , VOL [2] = MW [1] PATHIGHT SELECTLINK = (link = 116264-319 || 118664-31 9), VoL [3] = MW [2] Other Output Other Output PathHight SELECTLINK = (Link = ** 319- 116264 || 319118664 **), VOL [2] = MW [1] PATHIGHT SELECTLINK = (link = ** 116380-320 || 116846-320 **), VOL [3] = MW [2] Other outputs desired output
Other output pathhigh SELECTLINK = (link = 319-116264 || 319-118664), VOL [ 2]] = MEGA T [1] PATHIGHT SELECTLINK = (link = 116264-319 || 118664-31 9), VOL [3] = MW [2] Other Output Other Output PathHead SELECTLINK = (link = ** 320-116380 || 320- 116846 **), VOL [2] = MW [1] PATHIGHT SELECTLINK = (link = ** 116380-320 || 116846-320 **), VoL [3] = MW [2] Other output<<every_errorin:
Pre> #! Use / usr / bin / perl strict; Use warnings; Use list: More Qualifications QW (each_array); My @ x = qw (ABCDF); My @ or = (10, 11, 12, 13, 14, 15); My $ it = every_are (@x, y); While (mine ($ x, $ y) = $ it- & gt; ()) {print "$ x = $ y \ n"; } __END__
Comments
Post a Comment