in reply to Basic Perl Regular Expressions
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'.#!/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"; }
Also, check out the Tutorials on this site. Very nice. There is one on Split and join.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Basic Perl Regular Expressions
by monkfish (Pilgrim) on Nov 12, 2001 at 09:03 UTC |