or perhaps 

$receivedmail = $1 if $data =~ / (\d+) /;

This assumes that 16764 will be the the first occurance of the digits. If you don't 
want column dependency, 
this will help

 

-----Original Message-----
From: Bob Showalter [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 10:29 AM
To: 'Stuart Clark'; 'Perl List'
Subject: RE: A simple question


> -----Original Message-----
> From: Stuart Clark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 17, 2002 11:08 PM
> To: 'Perl List'
> Subject: A simple question
> 
> 
> Hi All
> Is there an easier way of picking out the number 16764 in this line
> rather that using an array, split then $number[3]
> 
> I just want to get 16764 into $recievedmail
> 
> Is the answer something like this
> 
> $recievedmail = ($data)[3];
> 
> 
> $data = "Received 921MB 16764 3955 375  2.2%   1296  7.7%";

You can use

   $receivedmail = (split / /, $data)[2]

to avoid using an intermediate variable.

The regex proposed by John Krahn is likely faster, but it makes
more assumptions about the characteristics of the data than
the split does.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to