in reply to Match text in file with array and substitute array position ?
Here's how your for line reads, assuming you have 9 things in your array:
for ( $a=0;$a 9; $a++)
I'll leave it up to you to figure out what the missing character is =)
Also, note that your substitution will only replace the first occurrence of each code in each line. You'll need to add the /g modifier if you want to change all the matches.
Also, note that $a is a special variable in Perl, it's a package global used by sort subroutines and it's not usually the best choice for a throwaway.
If not P, what? Q maybe?
"Sidney Morgenbesser"
|
---|
In Section
Seekers of Perl Wisdom