Passing an array and modifying it,as a reference
#!/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 );
}
Related examples in the same category