#!/usr/bin/perl use warnings; use strict; my $text = "one, two, three, four"; while ($text =~ /\b(\w+)\b/g) { print $1, "\n"; }