On 1/18/08, bootleg86 bootleg86 <[EMAIL PROTECTED]> wrote: > Hi, > I can't for the life of me figure out what this is trying to do > $token = $$ ^ unpack "%L*", `ps -A | "./bin/gzip" > > Just seems to be it's trying to generate some random number. > I only know it's trying to XOR the process ID. > > What does this part do? > unpack "%L*", `ps -A | "./bin/gzip" > > Thanks
ps -A lists all the processes on a Unix machine. gzip compesses its input `ps -A | gzip` will compress the text that ps -A outputs. I presume the zipped version of your system's processes would look fairly random, as it got a bunch of random PIDs, times, names, etc http://perldoc.perl.org/functions/unpack.html > unpack does the reverse of pack: it takes a string and expands it out into a > list of values. "%L*" is a "template" for unpack, whatever that means. >From pack: "L An unsigned long value." I guess it expands the gzip'd string into longs, giving you a list of random longs. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/