With either DBD::CSV or DBD::AnyData (both of which use exactly the same SQL engine and can handle the kind of data you show) you can query an arrayref. With DBD::AnyData you can also use the ad_import() method to query a string. Either one can be done without writing to a temporary file.