Author: techfox9

Perl passing arrays to functions..

Thursday, October 9th, 2008 @ 9:34 pm

From http://www.cs.cf.ac.uk/Dave/PERL/node61.html ..


@array1  = (1..5);
@array2  = ("A".."E");

firstSub( \@array1,  \@array2);         # One

sub firstSub {
    my($ref_firstArray, $ref_secondArray) = @_;   # Two

    print("The first array is  @{$ref_firstArray}.\n");  # Three

    print("The second array is @{$ref_secondArray}.\n"); # Three

}

Perl


 


Comments are closed.