I'm fairly certain I'm attacking this incorrectly, so any advice is greatly appreciated... Task: I want to sort through my Solaris syslog (/var/adm/messages) looking for any system reboots which always start with the string SunOS and, if found, return that line and the next 20 lines, at least for starters. I was going to try and catch the line # of the line that has the SunOS in it and then increment that by 1, print that line from the array and then increment by 1 for 20 iterations. I scratching out something such as.....(I'm a complete newbie and I'm banging my head against the wall because either I'm completely attacking this with the wrong logic and/or I'm misinterpreting the usage of $. ......me thinks...help please...) #!/usr/local/bin/perl -w $file="/var/adm/messages"; printf "test of the emergency broadcast system\n"; open (FILE, "< $file") or die "can't open $file: $!"; @lines = <FILE>; foreach (@lines) { if ($_ =~ /SunOS/) printf "$_\n"; { for ($i = $.; $i ($. + 20);$.++) printf $lines[$i]; } }Thread Next