#!/usr/bin/perl -w use strict; sub setmode ($\@) { my $val = shift; splice(@{$_[0]}, 1, 0, $val); } my @a = qw(one two three); print join($/, @a), "$/__________$/"; setmode('add_test', @a); print join($/, @a), $/; __END__ result: one two three __________ one add_test two three