Another short one. Guess who decided it's time to really learn about pack and unpack. Inspired by this node Confession of a Perl Hacker

tachyon

map {print} unpack 'x9 A1 x10 A1 X3 A2 x6 A1 X27 A1 x12 A2 x4 A1 X13 A1 X4 A1 x12 A1 x8 A1 X12 A1 X12 A1 x12 A1 X7 A1 x14 A1 X20 A1 X8 A1 x1 A1 x7 A1 X7 A1 x12 A1', 'abcdefghijklmnopqrstuvwxyz~';

Replies are listed 'Best First'.
Re: Unpack her!
by dimmesdale (Friar) on Jun 16, 2001 at 19:15 UTC
    Not too hard once I learned about pack and unpack...interesting, though.
    #x9:skip 9 chars, x is null so print nothing #A1: you're at letter j #x10:skip 10 chars, as before #A1: you're at letter u #X3:means back up 3 chars #A2: you're at letters st #x6:skip 6 chars, as before ###...etc., does this untill it gets desired chars and maps ### them all to print(w/~ in stead of space) map {print} unpack 'x9 A1 x10 A1 X3 A2 x6 A1 X27 A1 x12 A2 x4 A1 X13 A1 X4 A1 x12 A1 x8 A1 X12 A1 X12 A1 x12 A1 X7 A1 x14 A1 X20 A1 X8 A1 x1 A1 x7 A1 X7 A1 x12 A1', 'abcdefghijklmnopqrstuvwxyz~';

      No not hard, just an interesting use of pack I thought. There are heaps of better ways to grab substrings! TIMTOWDI

      cheers

      tachyon