local $/ = ""; while (<>) { my ($station, %fields) = /(\S+)/g; print(join(' ', $station, @fields{qw( N E U )}), "\n"); }