Question : Modify .csv Files Using Perl

I would like to know how to use Perl to open and modify a csv file. Specifically, what is the code needed to read the attached "Pre Perl.csv" file, modify it and save it as the attached "Post Perl.csv" file.

Thanks.
Attachments:
 
Pre Perl parsing
 
 
Post Perl parsing
 

Answer : Modify .csv Files Using Perl

To correct that, you can just change the two "elsif ($next eq" lines to be:

elsif ($next and $next eq ...

That will check to make sure $next is defined before trying to compare it.

As to initializing a variable in perl, that just means assigning a value to it.  The warning is just saying that $next is undefined (either because it hasn't been assigned to yet or because it was explicitly undef'd).
Random Solutions  
 
programming4us programming4us