in reply to Regular Expression I think.
#!/usr/bin/perl -w use strict; # set up our changes my @lines = qw( This=That Some=Song ); my %changes = ( This => 'Other', Some => 'Corny' ); foreach my $line (@lines) { # for all the money $line =~ s/([^=]+)=/$changes{$1} . "="/e; } print join("\n", @lines), "\n";
Update: dchetlin is right, there's no need for /e. Oops.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Regular Expression I think.
by dchetlin (Friar) on Sep 27, 2000 at 01:05 UTC |