#!/usr/bin/perl -w use strict; my $line = " 0 10 9 4 1 0 0 0 2 2 1 1 0"; my @config = split /\s+/, $line; for (@config) { next unless $_ =~ /\w+/; print $_, "\n"; } #### C:\Code>perl split_num.pl 0 10 9 4 1 0 0 0 2 2 1 1 0