[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Question - Substitution



I have the following:

                $theInfo[$k] =~ s/\s$theName\s/ <a
href="c$j.html">$theName<\/a> /g;    
                $theInfo[$k] =~ s/^$theName\s/<a
href="c$j.html">$theName<\/a> /g;    
                $theInfo[$k] =~ s/\s$theName$/ <a
href="c$j.html">$theName<\/a>/g;    

when I try to change this to

                @theInfo =~ s/\s$theName\s/ <a
href="c$j.html">$theName<\/a> /g;    
                @theInfo =~ s/^$theName\s/<a
href="c$j.html">$theName<\/a> /g;    
                @theInfo =~ s/\s$theName$/ <a
href="c$j.html">$theName<\/a>/g;    

I get an error message saying MacPerl:

Can't modify array deref in substitution at md line 1370, near
"s/\s$theName\s/ <a href="c$j.html">$theName<\/a> /g;"
md had compilation errors.

I've not come across this before but understand that it's saying it
doesn't like the substitution command's reference via the $theName
and/or the $j.  I just don't understand why it doesn't like it. 
Reasons?

(I can live with the first format - it's just slow since there are
around 4,000 documents the program is cross indexing via the above. 
[Like one document a second and the program isn't even doing all of the
cross indexing yet.]  This is one huge bubble sort-like routine which I
will probably re-code after I've gotten it up and running.  But right
now I'm just trying to get it to run.  :-/  Thanks in advance for any
ideas!)  :-)

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch