Array indexing question

2008-07-10 Thread Anirban Adhikary
Dear list I want to capture the output of w and then I want to do some job as per the o/p of w command in my linux system. So i have written the code as follows use strict; use warnings; open (LS, "w|") or die "can't open w: $!"; my @arr = ; close (LS); shift @arr; shift @arr; my($one,$two,$three

Re: Array indexing question

2008-07-10 Thread Stephen Kratzer
On Thursday 10 July 2008 05:59:36 Anirban Adhikary wrote: > Dear list > I want to capture the output of w and then I want to do some job as per the > o/p of w command in my linux system. So i have written the code as follows > > use strict; > use warnings; > > open (LS, "w|") or die "can't open w:

Re: Array indexing question

2008-07-10 Thread Jay Savage
On Thu, Jul 10, 2008 at 5:59 AM, Anirban Adhikary <[EMAIL PROTECTED]> wrote: > Dear list > I want to capture the output of w and then I want to do some job as per the > o/p of w command in my linux system. So i have written the code as follows > > open (LS, "w|") or die "can't open w: $!"; > my @ar

Re: Array indexing question

2008-07-10 Thread Jay Savage
On Thu, Jul 10, 2008 at 8:48 AM, Stephen Kratzer <[EMAIL PROTECTED]> wrote: > > Anirban, > > The output of 'w' is delimited by whitespace, not necessarily a single space. > Try passing the pattern '\w+' to split. Something like this: > I think you meant "the '\s+' pattern". -- j -

Re: Array indexing question

2008-07-10 Thread Rob Dixon
Stephen Kratzer wrote: > On Thursday 10 July 2008 05:59:36 Anirban Adhikary wrote: >> Dear list >> I want to capture the output of w and then I want to do some job as per the >> o/p of w command in my linux system. So i have written the code as follows >> >> use strict; >> use warnings; >> >> open

Re: Array indexing question

2008-07-10 Thread Stephen Kratzer
On Thursday 10 July 2008 10:33:31 Jay Savage wrote: > On Thu, Jul 10, 2008 at 8:48 AM, Stephen Kratzer <[EMAIL PROTECTED]> wrote: > > Anirban, > > > > The output of 'w' is delimited by whitespace, not necessarily a single > > space. Try passing the pattern '\w+' to split. Something like this: > > I

Re: Array indexing question

2008-07-10 Thread Brad Baxter
On Jul 10, 5:59 am, [EMAIL PROTECTED] (Anirban Adhikary) wrote: > Dear list > I want to capture the output of w and then I want to do some job as per the > o/p of w command in my linux system. So i have written the code as follows > > use strict; > use warnings; > > open (LS, "w|") or die "can't op