Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Spanish translation of pack/unpack tutorial

by Hue-Bond (Priest)
on Jun 26, 2006 at 20:29 UTC ( #557655=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        struct SupplyRequest {
            time_t request_time;    // hola de solicitud
            int employee_id;        // empleado que la realiza
    ...
            short quantity;         // cantidad
            short urgent;           // ¿es urgente?
        };
    
  2. or download this
       Desplz.   Contenido (las direcciones de memoria aumentan hacia la d
    +erecha)
             0   160  44  19  62| 41  82   3   0| 98 111 120 101 115  32 1
    +11 102
                  A0  2C  13  3E| 29  52  03  00| 62  6f  78  65  73  20  
    +6f  66
    ...
                       p   a   p   e   r   c   l   i   p   s
            32     0   0   0   0   0   0   0   0|  2   0|  1   0
                  00  00  00  00  00  00  00  00| 02  00| 01  00
    
  3. or download this
        ($order_time, $monk, $itemname, $quantity, $urgent) =
            unpack( "l i Z32 s2", $rec );
    
  4. or download this
        pack  ('a8',"hello")       produce "hello\0\0\0"
        pack  ('Z8',"hello")       produce "hello\0\0\0"
        pack  ('A8',"hello")       produce "hello   "   
    ...
        unpack('Z8',"hello\0\0\0") produce "hello"
        unpack('A8',"hello   ")    produce "hello"
        unpack('A8',"hello\0\0\0") produce "hello"
    
  5. or download this
        ord(pack('b8','00100110')) produce 100 (4 + 32 + 64)
        ord(pack('B8','00100110')) produce 38 (32 + 4 + 2)
    
  6. or download this
        pack('h4','1234') produce 0x21,0x43 
        pack('H4','1234') produce 0x12,0x34
    
  7. or download this
    #!/usr/bin/perl -w
    use strict;
    
    ...
    DumpString($rec);
    $rec = pack('H4',"1234");                # debería producir 0x12,0x34
    DumpString($rec);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://557655]
help
Chatterbox?
[marioroy]: Naming things can be difficult, sometimes more so that the actual code :)
[karlgoethebier]: Lady_Aleena: You need to jump to some conclusion
[Lady_Aleena]: And what would I rename RolePlaying/Random .pm to if I move all the RolePlaying/Random modules to just Random? Random/Util.pm Random/Base.pm, maybe lowercase the file name to indicate it is a bit different? I don't know yet.
[marioroy]: What does Random do?
[karlgoethebier]: https://www. youtube.com/watch? v=42WNHGr1jGI
[Lady_Aleena]: karlgoethebeir, I finished another project tonight, making a module which printed stop printing. It was a headache and a half.
[karlgoethebier]: Lady_Aleena: Try it!
[Lady_Aleena]: marioroy, it has 3 subroutines which can be fed data to generate random things. See here.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2017-05-29 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?