in reply to Re: Arrays & Output printing?
in thread Arrays & Output printing?

I wondered about the output order also, but figured it was just a typo. However if the specified order is actually wanted:

#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1186032 use strict; use warnings; $/ = "END\n"; my @ORDER = qw/ TIME ALT TEMP COLOR STRENGTH /; for my $section (<DATA>) { print join ' ', map $section =~ /\b($_: \S+)/, @ORDER; } __DATA__ START TIME: 3 ALT: 3.1 TEMP: 4.3 END START TIME: 2.6 ALT: 8 TEMP: 1 END START TIME: 6.1 ALT: 7.2 COLOR: 43 STRENGTH: 7 TEMP: 9.3 END