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