in reply to combining lists, formatting and printing on windows

Q1: look at the lc and lcfirst functions.

Q2: look that the length and substr functions. Although some CPAN modules might be able to help.

Je suis Charlie.
  • Comment on Re: combining lists, formatting and printing on windows

Replies are listed 'Best First'.
Re^2: combining lists, formatting and printing on windows
by Aldebaran (Curate) on Apr 19, 2015 at 02:41 UTC

    Alright, thanks, lcfirst works well, but I'll be darned if I can cobble the whole thing together yet. I want now to insert 'Fear of' at the beginnning of the sentence, and I can't accomplish it. It makes no sense to me why it doesn't appear while the numbered match variables do:

    $ ./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. $

    The caller has changed a bit, but the substitution happens here:

    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; }

    I tried putting it in single quotes to no avail....