J
joe rockhead
I'm not sure what the name of the concept is, but here goes.
I want to find 1 or 2 or 3 and replace it with a or b or c.
if it finds 1, replace it with a.
2 => b
and 3 => c.
I understand that
s/1|2|3/x/
replaces 1,2 or 3 with x.
anyway here's what I'm doing about it:
use IO::All;
my @list = io('list.txt')->slurp;
my $message < io 'passage.txt';
for (@list){
my ($preFilter, $postFilter) = split /=/, $_;
$message =~ s/$preFilter/$postFilter/g;
}
Where list.txt:
486DX=P4
640KB=2GB
50MB HDD=400GB HDD
1.44MB FDD=Flash Media Reader
6X CD-ROM=6X DL DVD
and message.txt:
My blasing fast 486DX with 640KB of RAM
50MB HDD 1.44MB FDD
6X CD-ROM
so I'm thinking:
s/1|2|3/a|b|c/
but that dosen't work.
what I'm I looking for?
what's it called?
I want to find 1 or 2 or 3 and replace it with a or b or c.
if it finds 1, replace it with a.
2 => b
and 3 => c.
I understand that
s/1|2|3/x/
replaces 1,2 or 3 with x.
anyway here's what I'm doing about it:
use IO::All;
my @list = io('list.txt')->slurp;
my $message < io 'passage.txt';
for (@list){
my ($preFilter, $postFilter) = split /=/, $_;
$message =~ s/$preFilter/$postFilter/g;
}
Where list.txt:
486DX=P4
640KB=2GB
50MB HDD=400GB HDD
1.44MB FDD=Flash Media Reader
6X CD-ROM=6X DL DVD
and message.txt:
My blasing fast 486DX with 640KB of RAM
50MB HDD 1.44MB FDD
6X CD-ROM
so I'm thinking:
s/1|2|3/a|b|c/
but that dosen't work.
what I'm I looking for?
what's it called?