Loading ...
Sorry, an error occurred while loading the content.

Re: How can I remove the quotes from within this array or cvs file?

Expand Messages
  • Yogesh Sawant
    ... $data =~ s/ //g; # remove all double quotes
    Message 1 of 3 , Apr 13, 2007
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, "chipwillis2003"
      <chipwillis2003@...> wrote:
      >
      > How can I remove the quotes from within this array?
      > Or would I read the entire file first and remove the quotes from it
      > first?
      > Can I get an example of the best solution?
      > Here is my code:
      >
      > # open the comma delimated file
      > open (TXTFILE, "c:/SOARimports/NU_AD2032_ILINC_EXTRACT_stf.csv") or
      > die("Unable to open file");
      > @lines = <TXTFILE>;
      >
      > # read file into an array
      > foreach $data(@lines) {
      > #loop through file putting users in array here

      $data =~ s/\"//g; # remove all double quotes

      > # split the line of text by comma
      > my @values = split(',', $data);
      >
      > # put the line into an array
      > my($InstructorID,$InstFname,$InstLname,$InstEmail) = @values;
      >
      > Here is an example of the cvs file:
      > "100043093","Long,Paul",longps@...
      >
      > I need to remove the quotes.
      > Thank you,
      > Chip
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.