<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Thank you, both. I think I have solved my problem. I actually misspoke
when I said that it prints n="$nCR" because actually a search and
replace operation calls up a value from the array. In the end the
following solved my problem: <br>
<br>
    @nCR = (a .. z);<br>
    $nCR = $nCR++;<br>
    $nCR = 'a' if $nCR++ eq 'z';<br>
<br>
This calls up letters in alphabetical order and returns to "a" after
"z". <br>
<br>
Daniel<br>
<br>
Ben Morgan wrote:
<blockquote
 cite="mid:bbb201fa0807050128r38b4f369ncf9cbafeae8dcb46@mail.gmail.com"
 type="cite">
  <pre wrap="">You don't really need an array (though it doesn't hurt):

$nCR='a';
for my $i (0..100){
   print "$nCR\n";
   $nCR = 'a' if $nCR++ eq 'z';
}

Also, remember not to use a single = in if statements, as that will do
assignment
 if ($nCR = @nCR[25]) {
will set $nCR to z and thus through the first block which does numeric
addition - so it converts it to a number.

God Bless,
Ben
-------------------------------------------------------------------------------------------
The Lord is not slow to fulfill his promise as some count slowness,
but is patient toward you, not wishing that any should perish,
but that all should reach repentance.
2 Peter 3:9 (ESV)


On Sat, Jul 5, 2008 at 6:19 PM, Joachim Ansorg
<a class="moz-txt-link-rfc2396E" href="mailto:nospam+sword-devel@joachim-ansorg.de">&lt;nospam+sword-devel@joachim-ansorg.de&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi Daniel,

    </pre>
    <blockquote type="cite">
      <pre wrap="">    @nCR = (a ..z) # Creates the array
    $nCR = @nCR[0]; # Sets the value of $nCR to 0 ("a") at the beginning
of each file (book)

Then when I am creating cross-references it prints:

    n="$nCR"

and then after the note is created I have this at the end of the sub:

    $nCR ++;

so that the next cross-reference is b then c, etc. I want to cycle
through the array from @nCR[0] to @nCR[25] and then return to @nCR[0].
In other words the 27th cross-reference in a book should be n="a" not
n="aa".
      </pre>
    </blockquote>
    <pre wrap="">$nCr is not a reference into the array, it contains the value 'a' after the
first assignment. Then you call the operator ++ on that value. Perl has some
builtin magic for that operator (man perlop) for strings. So this is not what
you want.

This code cycles through the array nCr several times:

@nCr = (a..z);
for my $i (0..100) {
       print $nCr[$i % scalar(@nCr)] . " ";
}

Hope that helps,
Joachim
--
&lt;&gt;&lt; Re: deemed
<a class="moz-txt-link-abbreviated" href="http://www.bibletime.info">www.bibletime.info</a>

_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page

    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page

  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
PMBX license 1502 
</pre>
</body>
</html>