in reply to Re: Will Perl Scripts written on 64 Bit Windows run fine on 32 bit as well?
in thread Will Perl Scripts written on 64 Bit Windows run fine on 32 bit as well?

One area that I have discovered the hard way, 'pack/unpack' functions for 64 bit do not operate on 32 bit machines. This has made it difficulty for transferring large data files (like a database) between 32/64 bit machines.

I was trying to put a floating point number into a "Q" format (64bit integer) but on the 32 bit machine it threw an exception.

So maybe there are more functions, and maybe not!

Thank you

"Well done is better than well said." - Benjamin Franklin

  • Comment on Re^2: Will Perl Scripts written on 64 Bit Windows run fine on 32 bit as well?

Replies are listed 'Best First'.
Re^3: Will Perl Scripts written on 64 Bit Windows run fine on 32 bit as well?
by BrowserUk (Patriarch) on Dec 04, 2011 at 14:04 UTC
    I have discovered the hard way, 'pack/unpack' functions for 64 bit do not operate on 32 bit machines.

    I thought I'd covered that with "and (may) only support 32-bit integers.".

    I was trying to put a floating point number into a "Q" format (64bit integer) but on the 32 bit machine it threw an exception.

    Putting a floating point number into an integer makes no sense to me at all?

    I'm surprised you got an "exception". If I try to use 'Q' on my 32-bit installation, it simply tells me that it is invalid:

    c:\test>\perl32\bin\perl -wle"print pack 'Q', -1" Invalid type 'Q' in pack at -e line 1. c:\test>\perl32\bin\perl -wle"print unpack 'Q', 'abcdefghijklmnop'" Invalid type 'Q' in unpack at -e line 1.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      I may not be explaining myself properly -- I'll try again

      Perl can show as an integer values to at least 2**49.

      email:> perl -e '$r=2**49;print "$r\n";' 562949953421312

      If I use 'seek/sysseek', I can set the disk pointer to greater than 2**32 byte location in a 32bit disk file in Unix/Linux. I was trying to save 8 octets as a pointer in network order in a database. That database could then be moved back and forth from 32 to 64 and vice/versa. I built the database/script on a 64bit Linux machine and then tried to move to a 32bit AIX machine. The database and script did not work properly.

      Thank you

      "Well done is better than well said." - Benjamin Franklin

        Updated: corrected 'D' to 'd'.

        Ah okay. I see what you mean now.

        That said, I've previously successfully pack'd >32-bit file offsets using the 'D' 'd' format. It handles files up to at least 4 Petabytes which will easily cover anything I'm going to have to deal with for the foreseeable future.

        But I appreciate that it is less portable than a network order quad.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?