laziness, impatience, and hubris | |
PerlMonks |
Re: parsing output of UNIX `who` commandby shmem (Chancellor) |
on Oct 02, 2006 at 08:12 UTC ( [id://575845]=note: print w/replies, xml ) | Need Help?? |
You could read the output of who via backticks as one long string with embedded newlines:
To get a hash of it, you'd have to split the string on newlines, then split each line:
But you could also use open to read from who:
Now you have a populated hash.
--shmem _($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In Section
Seekers of Perl Wisdom
|
|