use Path::Tiny; my @choices = ( path('/usr/home/test/public_html/front-one.txt'), path('/usr/home/test/public_html/front-two.txt'), path('/usr/home/test/public_html/front-three.txt'), ); my $random_path = $choices[rand scalar @choices]; my $text = $random_path->slurp; print "$text";