in reply to will this random-text script work? how do i integrate a template?

Any time you see code that is almost the same, except for variable names or constants, make it the same:

sub get_random_line { my $filename = shift; open my $fh, '<', $filename or die "Cannot read '$filename': $!\n" +; return random_line( $fh ); } my $filename; if (my $cut =~ /[a-e]/i) { $filename = 'infinity01.txt' } elsif ( ... ) { ... } my $random_line = get_random_line( $filename );
  • Comment on Re: will this random-text script work? how do i integrate a template?
  • Download Code