in reply to Appending string to all lines

So I tried it within a single line script with strict and warnings. It generated this error:
How are we supposed to guess your error if you don't show your script? Please show the code.

Replies are listed 'Best First'.
Re^2: Appending string to all lines
by bentrim (Initiate) on Nov 11, 2016 at 15:45 UTC

    It is simply a single line attempt.

    #!/usr/bin/perl use strict; use warnings; perl -ne 'chomp; printf "%sUF,A,Y,9,U\n", $_' test2.csv;
    It generates the Bareword error. I have been reading on that topic and can see that the earlier comment pointing me to Text::CVS module is the correct approach. So that is where I'm going.

    Thank you.

      That should indeed generate syntax errors because perl is not a valid function name in Perl. You can't just type random shell commands into perl and expect it to process them like your shell would - they are completely different systems.

      #!/usr/bin/perl -n use strict; use warnings; chomp; printf "%sUF,A,Y,9,U\n", $_;

      See perlrun for how to use flags like -n and perlfunc for a list of all the functions available. Note that I've made no attempt to optimise your algorithm here.