programming-examples/perl/Subroutine/Passing an array and modifying it,as a reference.pl
2019-11-15 12:59:38 +01:00

16 lines
233 B
Perl

#!/usr/bin/perl -w
@array = (1,2,3,4,5,6,7,8,9);
print "Before: @array.\n";
mod_array( \@array );
print "After: @array.\n";
sub mod_array {
my( $arrayref ) = $_[0];
@$arrayref = reverse( @$arrayref );
}