in reply to parsing data pairs from single line

You can assign it to a hash using split.

my $text = "pro my project con my customer date 2009-10-5 at 17:00 pri + 2 msg Rack new server"; my @list = split /(pro|con|date|at|pri|msg)\s/, $text; shift @list; my %hash = @list; foreach(sort keys %hash) { printf "$_, %s\n", $hash{$_} }