Thank you, David, Jenda and Kate for explaining this so clearly. I would have had trouble understanding this on my own. Your explanations were very easy to grasp.
I think I found what you're talking about on page 118-119 of Programming Perl 3, although this point seems very subtle. Is there another explanation on another page or anywhere in other documents that I could read more on this? If you can think of one off the top of your head, thanks. If not, don't spend time looking one up. Thanks so much, again. -Kevin >>> "David Gray" <[EMAIL PROTECTED]> 03/20/02 02:40PM >>> > I'm trying to process a list like so: > foreach ("photoshare", "mmc", "popline", "popline/www", "popline/db", > "netlinks") { > ... > s#/#.#g; > system("$apath/analog -m +g${acfgpath}/${_}.analog.cfg > +F$YY${MM}01 +T$YY${MM}31 +O${aout > path}/index.html"); > } #end for each subject area > > In other words, I want to > substitute "." for "/" in the magic variable $_ in each foreach loop. > > When I try to run this, I get "Modification of a read-only > value attempted at ./2001.analogall.pl line 81." The print > statement in line 80, just above the substitution statement, > shows the contents of $_ to be "photoshare" like I expected. It's because you're looping over a temporary anonymous list. I would guess it's stored as constant to make it more efficient. You're gonna have to save a copy to play with, like: foreach('photoshare','mmc') { ... # stuff my $tmp = $_; $tmp =~ s#/#.#g; system("...${tmp}.analog.cfg..."); } Hope that makes some sense, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]