in reply to Pack command

Presumably, you want to pack the four octets of the IP as chars in the output string? (Your use of '01 01 01 09' to indicate this is quite confusing--looking more like you want the ascii-ized value padded with leading zeros!).

Assuming that the var $ip contains the ip in it's ascii form (with '.' delimiters) the answer is "No, not directly". You will need to break the IP up into it numeric components before passing it to pack:

$new = pack 'ncC4n', 10, 10, split( '\.', '1.1.1.9' ), 30; print unpack 'C*', $new; 0 10 10 1 1 1 9 0 30

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?