I have a list of some 30000 Swedish words. The words of 3 extra swedish alphabets ö , å, å
I wish to create a backward dictionry (Alphabetical sort from the last letter of the word) so that all the words with similar suffixes are together.
In order to achieve this i tried to convert all the words to their reverse using reverse function but the 3 extra alphabets are replaced with some other charecters
¥ - å
€Ã -ä
¶Ã - ö
this is my code to reverse the word. How do i convert the string to reverse without getting above mentioned characters
my code to reverse is like this
#!/usr/bin/perl -w
# Reading protein sequence data from a file, take 3
# The filename of the file containing the protein sequence data
$filename = 'svensk.txt';
# First we have to "open" the file
open(FILE, $filename);
# Read the protein sequence data from the file, and storeit
# into the array variable @protein
@WORDS = <FILE>;
# Print the protein onto the screen
##print scalar (@protein);
foreach $str (@WORDS)
{
$str2 = reverse $str;
print $str2;
}
close PROTEINFILE;
exit;
Is
2019-02-08 Athanasius added code and pre tags
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.