[sword-devel] perl arrays and usfm2osis.pl

Daniel Owens dhowens at pmbx.net
Sat Jul 5 00:53:29 MST 2008


I'm stuck on a perl problem, and I think I don't know the right 
terminology to use with Google to find the answer. Tutorials on arrays 
don't cover this, as far as I can see.

I created an array for the n attribute in cross-references:

    @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".

I am sure there is an easy way to do this, but when I tried:

    if ($nCR = @nCR[25]) {
       $nCR += @nCR[0];
    }
    else {
    $nCR ++;
    }

It makes n into a number rather than a letter.

I know there must be something basic I am missing, so I am hopeful 
someone has a quick solution to this.

Daniel




More information about the sword-devel mailing list