Array element split, with grep
- From: iaccounts@xxxxxxxxxx (Steve Bertrand)
- Date: Wed, 30 Apr 2008 15:37:10 -0400
Hi all,
Can someone explain to me how I can fix this up to achieve my desired results?
my $time = (split (/:/, (grep (/^info/, @contents))))[0];
A sample snip of data:
this382:3828
info447:4729
that274:9294
....and I just want the $time to become info447.
The way I think it works is:
- grep out the single entry from the @contents array
- split that entry on the : delimiter
- insert into $time the first element of the split
I can do it with more than one line, but I've become accustomed to using split in array fashion, however, never with grep before.
Thank you for any insight.
Steve
.
- Follow-Ups:
- Re: Array element split, with grep
- From: Steve Bertrand
- Re: Array element split, with grep
- Prev by Date: Re: I want a perl script for?
- Next by Date: Re: Array element split, with grep
- Previous by thread: I want a perl script for?
- Next by thread: Re: Array element split, with grep
- Index(es):
Relevant Pages
|
|