#!/usr/bin/perl use strict; use warnings; use Getopt::Long; our %opt = (); { my %options = ( 'file=s' => \$opt{file}, ); GetOptions(%options); } exit 0 unless $opt{file}; my $filename = $opt{file}; open(my $fh, '<:encoding(UTF-8)', $filename) or die "Could not open file '$filename' $!"; print "string => \""; while (my $row = <$fh>) { chomp $row; if ( $row =~ /\.*/) { $row =~ s/\.*/\\N\{U+$1\}/g; print $row; } } print "\"\n";