#!/usr/bin/env perl use strict; use warnings; use Path::Tiny; my $dir_path = path('text_files'); my @choices = $dir_path->children; unless( scalar @choices > 0 ){ die "No text files found in $dir_path"; } my $random_path = $choices[rand scalar @choices]; my $text = $random_path->slurp; print "The text is: $text\n"; exit;
In reply to Re^2: Show different text based on random number
by kevbot
in thread Show different text based on random number
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |