$ perl -wle 'my $str = "a, b,"; my ($first) = $str =~ /(.*),/; print $first' a, b