in reply to Array Reference (Again)
#!/usr/bin/perl -w
use strict ;
#
sub xxrc_ref {
#
use strict ;
#
my @tester = qw(a b c d) ;
my $rarray = \@tester ;
#
return $rarray ;
}
#
#######################################################
# Variables #
#######################################################
#
my $row = undef ;
my @response = undef ;
#
print "\n\t<****** SOR ******>\n" ;
#
@response = @{xxrc_ref()} ;
#
print "\n\tResponse = @response\n" ;
#
for $row (@response) {
print "\n\t$row\n" ;
}
#
print "\n\t<****** EOR ******>\n\n" ;
(although you might just as well return an array in that case), or you could do this:
#!/usr/bin/perl -w use strict; sub xxrc_ref { my @tester = qw(a b c d) ; my $rarray = \@tester ; return $rarray ; } ####################################################### # Variables # ####################################################### my $row; my $response; print "\n\t<****** SOR ******>\n" ; $response = &xxrc_ref() ; print "\n\tResponse = $response\n" ; for $row (@$response) { print "\n\t$row\n" ; } print "\n\t<****** EOR ******>\n\n" ;
|
|---|