use DBI; $dbh = DBI->connect("dbi:mysql:mydb;192.168.3.4","root","password"); $sth2 = $dbh->prepare("select data from inbound where inboundid=1234"); $rv2 = $sth2->execute; %inbound = %{$sth2->fetchrow_hashref}; open(ZIP, ">data.zip"); print ZIP $inbound{'data'}; close(ZIP); result: New system - -rw-r--r-- 1 root root 5928 Feb 7 2004 temp.zip Old system - -rw-r--r-- 1 root root 4000 Feb 7 2004 temp.zip