in reply to Help with Regular Expressions and Perl
Output:use strict; use warnings; my $variable = join("", <DATA>); my @num = qw|zero one two three four five six seven eight nine|; $variable =~ s/(\d)/$num[$1]/g; print "$variable"; __DATA__ This is 1 great time 2 have a 3 way 4some. When 5 and 6 together make 11. Some 8 or 9 of us will see that.
Update:Thanks JavaFan(++) for the heads-up on \d - My education continues.This is one great time two have a three way foursome. When five and six together make oneone. Some eight or nine of us will see that.
Syntactic sugar causes cancer of the semicolon. --Alan Perlis
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with Regular Expressions and Perl
by JavaFan (Canon) on Apr 01, 2010 at 08:27 UTC | |
|
Re^2: Help with Regular Expressions and Perl
by cdarke (Prior) on Apr 01, 2010 at 09:02 UTC |