in reply to Separating array contents
Suggestion:
This will handle the !-character in the beginning so that it won't generate an empty cell. It also trims the strings in the cells as in your description you had "is " -> "is". Update: improved trim regexuse 5.014; use Data::Dumper; my @arr = ('!', 'my', 'name', '!', 'is ', '!'); my $joined = join '' => map { s/^\s+|\s+$//g; $_ } @arr; $joined =~ s/^!|!$//g; my @result = split /!/ => $joined; say Dumper(@result);
|
---|
In Section
Seekers of Perl Wisdom