Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Storing system grep's output to an array in perl

by rjt (Deacon)
on Mar 07, 2013 at 12:26 UTC ( #1022223=note: print w/replies, xml ) Need Help??


in reply to Storing system grep's output to an array in perl

The pure Perl solution will be faster, more portable, and much sexier (substitute your actual filehandle opened with open for <DATA>):

#!/usr/bin/env perl use 5.010; use warnings; my @times = map { /^(?:top - (..:..:..))/ } <DATA>; say for @times; __DATA__ top - 00:35:18 up top - 01:23:45 other junk completely different format altogether not - 01:23:45 can't fool me! top - 02:35:46 top - 03:46:07

Output:

00:35:18 01:23:45 02:35:46 03:46:07

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022223]
help
Chatterbox?
[LanX]: ... well like always :)
[zentara]: LanX One day, I will see a great interest in Tk. It's small, self-contained, needs very few external libraries, AND makes it easy to make high-contrast displays. :-)
[zentara]: Corion in this cased they left the www. out
[zentara]: /d// :-)
[LanX]: i like tk, just joking. but what about modern styles?
LanX has to run. .. o/
[zentara]: modern styles are secondary to display readability. Tk is automatically good at the clunky industrial theme. :-)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2017-05-26 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?