$ ./fears1.pl enter basename for file rt2 returned was 0. dying exists because it's everyone's greatest terror, likely laden with pain. 1. abject poverty exists because my earning power has been decreasing and a regime is on the ascendance that wants to crush my class. 2. being homeless exists because it's awful and the result of 1. 3. cancer, disease exists because it runs in the family and can happen spontaneously with appreciable probability. it's expensive. $ #### sub pop_texts { use strict; use 5.010; use File::Slurp; my ($rvars) = shift; my %vars = %$rvars; my @fears = read_file( $vars{fears} ); my @causes = read_file( $vars{causes} ); for (@fears) { s/\s+$/ /; $_ = lc($_); s/^(\d+\. )(.) /$1 Fear of $2/; } for (@causes) { s/^\d+\./exists because/; $_ = lc($_); } #say "causes are @causes"; my $text1 = ''; for my $i ( 0 .. $#causes ) { $text1 = $text1 . $fears[$i] . $causes[$i] . "\n"; } my $reftext = \$text1; return $reftext; }