Yes, you can use Text::CSV_XS on a string, via its functional interface

use warnings; use strict; use feature 'say'; use Text::CSV_XS qw(csv); # must use _XS version my $csv = qq(a,line

and,another); my $aoa = csv(in => \$csv) or die Text::CSV->error_diag; say "@$_" for @aoa;

Note that this indeed needs Text::CSV_XS (normally Text::CSV works but not with this).

I don't know why this isn't available in the OO interface (or perhaps is but is not documented).

While the above parses the string directly as asked, one can also lessen the "inelegant" aspect in your example by writing content directly to a file as it's acquired, what most libraries support like with :content_file option in LWP::UserAgent::get method.