Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8362715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:00:18+00:00 2026-06-09T12:00:18+00:00

I am currently trying to add speech marks onto the start and end of

  • 0

I am currently trying to add speech marks onto the start and end of a line which I have an edited from a CSV file and is currently stored in an array; I am currently trying to use push and unshift.

use warnings;
use Text::CSV;
use Data::Dumper;
use constant debug => 0;
use Text::CSV;

print "Running CSV editor......\n";

#my $csv = Text::CSV->new({ sep_char => ',' });

my $file = $ARGV[0] or die "Need to get CSV file on the command line\n";

my $fileextension = substr($file, -4);

#If the file is a CSV file then read in the file.
if ($fileextension =~ m/csv/i)
{   
print "Reading and formating: $ARGV[0] \n";

    open(my $data, '<', $file) or die "Could not open '$file' $!\n";

    my @fields;

    while (my $line = <$data>) 
    {       
    #Clears the white space at the end of the line.
    chomp $line;

    #Splits the line up and removes the <br />.
    my @lines = split qr{<br\s?/>}, $line;

    #Removes the control character.     
    shift (@lines); 
    print "\n";
    print $_,$/ for @lines;

    push (@lines, "\"");
    unshift (@lines, "\"");

When I try and use the final two lines it doesn’t add anything onto the start and end.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:00:19+00:00Added an answer on June 9, 2026 at 12:00 pm

    How do you know that the quotes aren’t getting added to the array? Your syntax is correct, so they are definitely working. Try something like this.

    my $newStr = join $/, @lines;
    print $newStr;
    

    and see what that prints, I bet the quotes will be there 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So currently I am trying to add a feature to a userscript I have
I'm currently trying to implement a simple Add-In for InfoPath 2010 Filler/Editor mode, which
I'm currently trying to add the facebook apps request from our java server using
i am currently trying to add a uploading/scanning screen to my file upload site,
i am currently trying to assign each character that i get from a file
I am currently trying to add functionality to our company's ASP.NET website which will
I am currently trying to add the WMD editor to my site. I have
I am currently trying to add a widget to my application and have been
Currently trying at add ajax to a site, after much reading I discovered that
I'm currently trying to add PGP signing support to my small e-mail sending script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.