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

  • Home
  • SEARCH
  • 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 7665817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:40:25+00:00 2026-05-31T14:40:25+00:00

Update: Salva correctly points out that I was wrong about the introduction of the

  • 0

Update: Salva correctly points out that I was wrong about the introduction of the “Q” pack template. It’s the “>” modifier that doesn’t go back to 5.8.

Perl 5.10 introduced the pack() modifier “>”, which, for my use case with “Q” packs an unsigned quad (64bit) value in big endian.

Now, I’m looking for an efficient equivalent for

pack("Q>2", @ints)

where @ints contains two 64bit unsigned ints. “Q>2” means “pack two unsigned quads in big-endian byte order”. Obviously, I want this because I am (at least temporarily) tied to a pre-5.10 Perl.

Update2: Actually, on further reflection, something as simple as the following should do:

pack("N4", $ints[0] >> 32, $ints[0], $ints[1] >> 32, $ints[1])

Appears to work on my 64bit x86-64 Linux. Any reason why this might not be exactly the same as pack("Q>2", @ints)? Any platform-specific matters?

What’s the reverse (ie. equivalent to unpack(“Q>2”, @ints))?

  • 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-31T14:40:27+00:00Added an answer on May 31, 2026 at 2:40 pm

    The Q pattern was introduced in perl 5.6. Your real problem may be that you are trying to use it in a perl compiled without 64bit support.

    Anyway, you can use Math::Int64.

    Update, an example:

    use Math::Int64 qw(int64_to_native);
    my $packed = join '', map int64_to_native($_), @ints;
    

    Another option, if you are on a 64bit perl supporting Q but not Q>, is to reorder the bytes yourself:

    pack 'C*', reverse unpack 'C*', pack 'Q', $int;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE UPI_ATTRIBUTE SET SITE_INC ='0' WHERE USER_PROFILING_NAME IN ('CAR_IMPLICIT','CAR_EXPLICIT') Above is my query that
UPDATE 6/21/12 I have a form in rails that is working similar to an
Update I want to have an expression (XPath, or Regex Expression, similar) that can
UPDATE: Thanks for the answers! I can't seem to figure it out, even with
UPDATE: I found that the easiest way is to use AQuery . I need
I can't figure out why this simple lines of code simply doesn't work: //
Update : Turns out I was being very stupid. I was checking the modification
UPDATE 1 ADDED UPDATED CODE I have a django template on app engine. Currently
Update: Tried November CTP release. Same error message. Forgot to mention that this server
Update 14th May It's the mix of text sizes that breaks it, if I

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.