in reply to Looping through a file
Three pointers,
first, put
use strict; use warnings;
at the top of your file. That would point out any jarring issue you have in your code (also surround your code here with <code></code> tags).
Declare your variables with my and run it again.
Two, say open(my $PARTS, '<', $partlist) and while (<$PARTS>) to better arrange your file handling.
Third, 0 is Perl's false state (among others) so unless ($found) would do (also, numeric equal is ==, not eq so you need to say $found == 0 and $PARTS eq $ordnum).
Try these and see what errors you pick up.
As for your code itself, you run through the entire @parts, then check on the state of $found. If $found is a counter (as you say in the comments, say $found++. If its an indicator, you need to do something when you locate a file.
Software speaks in tongues of man.
Stop saying 'script'. Stop saying 'line-noise'.
We have nothing to lose but our metaphors.
|
|---|