#!/usr/bin/perl -w use strict; use Data::Dumper; $_ = [ grep {$_} split /[\s,:]/ ] for my @data = ; print Dumper \@data; __DATA__ foo bar, baz this that: those