http://www.perlmonks.org?node_id=317125

bl0rf has asked for the wisdom of the Perl Monks concerning the following question:

After reading the pack/unpack tutorial by pfaut I felt brave and decided to do some things with the scariest function in Perl. I saw something very weird that I hope you might explain to me.

$number = 1145258561; print pack( "l", $number ); # prints: ABCD
The number above is the result of a concatenation of the letters ABCD ( I'll put the whole thing in the code snippets section later ). What I don't understand is why Perl convert the number into four characters instead of into a "long" number

I'm completely puzzled, and Perl even converts the number into the correct letters ( okay, I converted them to binary, concatenated and converted to a long again before doing the above ). Could somebody explain this madness to me, as my work with pack/unpack is purely hit-and-miss :-(

Thanks for your help.