I am smelling an XY Problem. So here is some code that takes $text and creates an array @words containing all the words in $text. In addition, it adds a comma to each word, but my guess is, that you are not really interested in that...
use strict; use warnings; my $text = <<EOTEXT; This is a word. Here is another sentence. EOTEXT my @words = $text =~ /\b(\w+)\b/g; print "@words\n"; $_.="," for @words; print "@words\n";
Thanks to toolic for the sample text.
In reply to Re: Modifying text file
by hdb
in thread Modifying text file
by torres09
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |