Or say it in regexp:
while( <FILE> ) {
if ( /^([^\,]*\,\s*[^\,]*)\,\s*(.*)$/ ) {
print "Name: $1\n";
print "Address: $2\n";
}
}
To explain the regexp: the first ^ matches beginning of line, the
([^\,]*) captures the next contiguous set of non comma characters and places it in the first "numbered" variable ($1), the \,\s* steps over the first comma and any immediately trailing space, (update: that is now repeated to allow for the fact that there is a comma in the name field), the (.*) picks up everything thereafter placing it in the $2 variable and the $ matches with the end of the line.