> -----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]