in reply to Problem while refactoring code into a subroutine (was: subroutines!!!)

Instead of:

$dna[$i]

You want:

$dna->[$i]

Since $dna and $complement are array references, you need the arrow to de-reference back to the underlying array.

Replies are listed 'Best First'.
Re: Re: subroutines!!!
by Anonymous Monk on Mar 25, 2003 at 11:35 UTC
    If i wanted to return two arrays instead of one; e.g.
    return (\@array, \@array2);
    What is the syntax to using these arrays once they have been returned?? cheers

      You do exactly the same thing. The values you get back will be array references so you access the elements using the -> syntax.

      --
      <http://www.dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg