Hey everyone,
I have a file that is java script. At the beginning of the file I define an array of pictures like this:
images[0]="....stuf...";
images[1]="....stuf...";
images[2]="....stuf...";
...
images[15]="....stuf...";
Anybody can add their images to my database - pretend database-, but there is a max of 15 - i.e. when there are 15 pictures in the array, and another one is added it becomes images[0], images[1] becomes images[2], etc and images[15] is dropped off.
I want to be able to do this:
$line=~ s/images[$count/images[$count1/;
where count is initially 0 and count1 is initially 1 thus incrementing the array by 1 and dropping number 16.
note: I am reading every line from the .js file, incrementing the array and writing the incremented file over the old .js file.
I get this error:
Unmatched [ in regex; marked by <-- HERE in m/images[ <-- HERE 0/ at eng_pics.cgi line 135.
How can I substitute part of a variable for another variable?
I hope I was clear.
Any suggestions would be appreciated.
Thanks,
Michael
I have a file that is java script. At the beginning of the file I define an array of pictures like this:
images[0]="....stuf...";
images[1]="....stuf...";
images[2]="....stuf...";
...
images[15]="....stuf...";
Anybody can add their images to my database - pretend database-, but there is a max of 15 - i.e. when there are 15 pictures in the array, and another one is added it becomes images[0], images[1] becomes images[2], etc and images[15] is dropped off.
I want to be able to do this:
$line=~ s/images[$count/images[$count1/;
where count is initially 0 and count1 is initially 1 thus incrementing the array by 1 and dropping number 16.
note: I am reading every line from the .js file, incrementing the array and writing the incremented file over the old .js file.
I get this error:
Unmatched [ in regex; marked by <-- HERE in m/images[ <-- HERE 0/ at eng_pics.cgi line 135.
How can I substitute part of a variable for another variable?
I hope I was clear.
Any suggestions would be appreciated.
Thanks,
Michael