Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


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"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://216568]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2023-06-08 05:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (29 votes). Check out past polls.

    Notices?