Thank you, wog, I was looking for code similar as your approach, but I failed to find any suitable solution. I've tweaked and wrapped the code a bit, just to run it under MacPerl.
#!perl -w
use strict;
my $tmpdir = 'Disco:Carpeta_Idioma:';
my $file = "$tmpdir" . 'diccionario';
my $file_out = "$tmpdir" . 'diccionario2';
open(IN, "<$file") || die "Can't open $file: $!\n";
open(OUT, ">$file_out") || die "Can't open $file_out: $!\n";
while (<IN>) {
print OUT unless ( y/a//>3 | y/b//>1 |
y/c//>1 | y/d//>2 |
y/e//>8 | y/g//>1 |
y/i//>3 | y/j//>1 |
y/l//>2 | y/m//>3 |
y/n//>3 | y/o//>4 |
y/r//>3 | y/s//>6 |
y/t//>1 | y/u//>2 |
y/v//>2
)
}
close IN;
close OUT;
The code snippet looked nice indented on my Mac. Hope it looks fine here too.
Best regards,
Richard
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.