use strict; while (1) { my @array; foreach (1..20) { my $line = ; chomp $line; push @array, $line; } print "@array[5, 15]\n" if $array[9]=~m/IC--E/; last if eof; } __DATA__ 1 Software Package: "xxxxxxx" 2 Operation: install 3 Mode: not-transactional,not-undoable | force 4 Time: XXXXXXX 5 ================= 6 WORKSTATION1: 7 8 Distribution ID: `xxxx.xxx' 9 10 Current software package status is 'IC--E'. 11 12 Operation successful. 13 14 Execution of user program 'during_install - C:\Staging\MS07-061_WXP_ENU.1.0.1.0\setup.exe (/s)' completed with result: 'success'. 15 16 User program exit code: 0 17 18 19 ================= 20 21 Software Package: "XXXXX" 22 Operation: install 23 Mode: not-transactional,not-undoable |force 24 Time: XXXXXX 25 ================= 26 WORKSTATION2: 27 28 Distribution ID: `XXXXX.XXXX' 29 30 Current software package status is 'IC--E'. 31 32 Operation unsuccessful. 33 34 Execution of user program 'during_install - C:\Staging\MS07-061_WXP_ENU.1.0.1.0\setup.exe (/s)' completed with result: 'success'. 35 36 User program exit code: 0 37 38 39 =================