in reply to Re^3: Show different text based on random number
in thread Show different text based on random number

Thanks. Do I have something wrong? This doesn't work:
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";

Replies are listed 'Best First'.
Re^5: Show different text based on random number
by kevbot (Vicar) on Apr 22, 2016 at 06:01 UTC
    What do you mean by "doesn't work"? Are you getting any output at all, such as an error message? As far as I can tell, your code should work. Check the following:
    • Is Path::Tiny installed?
    • Check your file permissions. Do you have read access to those files?
      No errors. The text just doesn't display. I have the right permissions. I'll confirm whether its installed. I'm pretty sure it is. Thanks.
        Empty file?