in reply to splitting punctuation in a text
and if you just needed the words without the punctuation marks:#!/usr/bin/perl use strict; use warnings; my $s = 'earth, wind & fire'; my @out = split /\b/, $s; print "$_\n" foreach (@out);
foreach (@out) { print "$_\n" if ($_ =~ /\w/); }
|
|---|