> 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]