This is just the sort of thing Perl is great at.
Here's a bit to get you started.
#!/usr/bin/perl -w
use strict;
my $sentence = 'A sentence is just a bunch of words';
# Do the magic.
my @words = split /\s/, $sentence;
# That was it! Now show the results.
foreach my $word (@words) {
print "$word\n";
}
And don't be shy about reading the docs that come with Perl.
They are really quite good. The key one in this case
(and for many beginner questions) is called 'perlfunc'.
Also, check out the Tutorials on this site.
Very nice. There is one on Split and join. |