#!/usr/bin/perl -w # test.pl -- use strict; use warnings; use diagnostics; my @a = ( 'one', 'two', 'three' ); print join("\n",@a),"\n__________\n"; setmode('add_test',@a); print join("\n",@a); sub setmode { my $val = shift(@_); my @a = @_; splice(@a,1,0,$val); $_[$_] = $a[$_] for (0..@a); } #### C:>test one two three __________ one add_test two #### sub setmode { my($val,$ref) = @_; splice(@$ref,1,0,$val); }