#!/usr/bin/perl use strict; use warnings; my $dfile = 'data'; my $sfile = 'source.txt'; my $tfile = 'target.html'; open DFILE, '<', $dfile or die "can not open '$dfile' because: $!"; open SFILE, '<', $sfile or die "can not open '$sfile' because: $!"; open TFILE, '>', $tfile or die "can not open '$tfile' because: $!"; my %words; while () { chomp; my ($key, $val) = split /:/; $words{$key} = $val; }; while ( ) { my @words = split /(?=\\)/; for my $word ( @words ) { $word = $words{ $word } if exists $words{ $word }; } print TFILE "@words\n
"; } close(SFILE); close(DFILE); close(TFILE); #### \ca\ra\ka\tl \ca\ra\ka\tl #### ਕ ਖ ਗ \tl
ਕ ꤖ ਗ \tl