use strict; use warnings; $_ = q|device1 is 2.3.5.1 . . . 56% /var 38% / 31% Interleaved device1 Tue Sep 9 11:26:44 ist 2005 logging to device2 is 2.3.5.1 . . . 56% /var 44% / 31%|; my @arr = /(device\d+)\sis\s.+?\/var\s+(\d+%)/g; print "@arr";