Yes, this correcto. You just have to define $comment and set its value.
One way would be to add another comma-separated value with the commentary. In this case you must replace:
my ($username, $givenname, $surname, $password) = split(',', $line);
with:
my ($username, $givenname, $surname, $password, $comment) = split(',', $line);
And then add to the lines the comment separated with a ',' from the previous field.
Cheers,
Javier