#!/usr/bin/env perl use strict; use warnings; my ($in,@array,$i,@foo); $in=0; while(<>){ if (/^OBS ASH CLOUD/) { $in=1; } elsif (/^\n/) { $in=0; } chomp; if($in) { $_=~ s/-//g; @array=split(/\s+/); push(@foo, @array); } } shift (@foo); shift (@foo); shift (@foo); shift (@foo); print "@foo\n";