in reply to Re^2: Matching part of a line and saving it into a variable
in thread Matching part of a line and saving it into a variable

The other monks have asked for data from you which is reasonable. You don't seem able to comply with such a simple request.

Nonetheless, I will attempt to help you solve your problem based on the code you posted above and some assumptions. N.B. this solution isn't promised to work since you won't comply with what the monks have asked.

In your code above, you posted a regular expression if (/\"(.*)\"/). If you change it to if (/\"(.*?),(.*?)\"/), it might work. Or maybe modify the split command to include commas might work.

Sure the solution above is vague, but then again so is your data. To solve your first line issue, easiest way is to keep a count variable.
#!/usr/local/bin/perl open (MYFILE, 'shoplist.csv'); my $i=0; while (<MYFILE>) { chomp; if($i == 0) { $i++; next; } if (/\"(.*)\"/) { my ($first,$last)=split('\s',$_); print "$last $first\n"; } } close (MYFILE);