I am completely new to Perl and would like some feedback/assistance. Hoping I don't make anyone cringe too badly.
Trying to open a list and use each item on the list to bring out information on that item from the open file. Items will be listed in the second column of the file, but if the item matches I need to print all columns for that file.
When I list all the items out directly in my code instead of opening the list, the code works. However, when I add the element of opening the list, I get no readout whatsoever.
There are no warnings, so I can't figure out what's wrong. The format of my list maybe?
#! C:\Perl\bin\perl -w open (LIST, "List.txt" ); @mylist = (<LIST>); open (FILE, "FILE.txt" ); @myfile = (<FILE>); foreach $file(@myfile) { foreach $list(@mylist) { @temp = split (/\t/, $file); chomp @temp; if ( $temp[1] eq $list ) {print ("$file")} } }
In reply to Looping in a Loop by Violet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |