![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Match text in file with array and substitute array position ?by arturo (Vicar) |
on Nov 29, 2002 at 17:42 UTC ( #216568=note: print w/replies, xml ) | Need Help?? |
Here's how your for line reads, assuming you have 9 things in your array:
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?
In Section
Seekers of Perl Wisdom
|
|