Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7611847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:45:51+00:00 2026-05-31T01:45:51+00:00

I have a perl object (reference to array of references) like the below: my

  • 0

I have a perl object (reference to array of references) like the below:

my $a = [ [$a, $ab, $c ], [$a, $b, $c] ] ;

and need to store it on the DB then retrieve it.

Could someone suggest a good mechanism to serialize even to compress it and then store it on the DB? Then deserialize it and use it in the code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:45:52+00:00Added an answer on May 31, 2026 at 1:45 am

    You may use any of the known serializers, e.g. JSON::XS or Storable.
    Storable is better if you want to retrieve references as references, not as copies of values. Then save a serialized object in the field of any type (VARCHAR, BLOB, …) that satisfy storage requirements.

    use Storable qw(nfreeze thaw);
    use DBI;
    
    # ... connect to database
    # Store
    my $data = [ [$a, $b, $c ], [ $a, $b, $c ] ];
    my $bytestream = nfreeze $data;
    $dbh->do('insert into table (field) values(?)', undef, $bytestream);
    
    # Retrieve
    $bytestream = $dbh->selectrow_array('select field from table where ...');
    $data = thaw $bytestream;
    

    Additionally, you can compress $bytestream, for example, via IO::Compress::Gzip

    my $bytestream = gzip nfreeze $data;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, in Perl, I have an array within an object (so, a reference to
I have a perl function that takes an open registry key object. Now, I
I have an existing Perl script that uses the FTP object to send a
I have a web scraping application, written in OO Perl. There's single WWW::Mechanize object
I have Perl script and need to determine the full path and filename of
I have a Moose class that i would like to store using Apache::Session::File. However,
I need to handle some HTTP URLs in a Perl program, but I have
I have a card game - written in Perl and with few objects, like
So I have some perl code that goes something like: use strict; use XML::XPath;
I have been using PerlXS to write a perl wrapper around a C++ Object.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.