my @data = qw( Mon Tue Wed Thurs Fri Sat Sun ); print get_day( $today, \@data ); sub get_day { my ( $index, $datar ) = @_; return $datar->[$index]; }