web_developer has asked for the wisdom of the Perl Monks concerning the following question:
I am new to perl but this is absolutely riddled with errors and I have written this according to examples of similar scripts.#!/usr/bin/perl<br> #read each line in test1.txt into data_file array<br> $data_file="test1.txt";<br> open(DATA, $data_file) || die("Could not open file!");<br> @data_file=<DATA>;<br> <br> #read each line in code.txt into a names_file array<br> $names_file="code.txt"<br> open(NAMES, $names_file) || die("Could not open file!");<br> @names_data=<NAMES>;<br> <br> #create loop that reads each ID in code.txt (NAMES array), searches fo +r<br> #each in array elements for test1.txt (DATA array), redirects a new<br +> #(NAMES).html for each element<br> foreach ( $NAMES )<br> {<br> chomp($NAMES);<br> ($NAMES=$DATA<0> > +("$NAMES<0>.html"));<br> }<br> <br> close NAMES;<br> close DATA;<br> <br>
|
|---|