Steve Hemond wrote: > > I want trap the results of 'ps -ef' command. > > I first trap the results by splitting the results in scalar values such as $uid $pid > $ppid $stime, etc... > > I would like, for each line returned, to hold these values in an array, so that, for > each uid, I could > return its corresponding pid, ppid, stime, cmd, etc. > > What would be the best data structure to use? An hash table in an array? ...
Hey Steve. Depending on what you want to do with the data, I would just keep a hash relating UID to the entire 'ps' output record: my %ps = map { /(\S+)/; ($1, $_) } `ps -ef`; and then split the record after later extracting it from the hash. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>