For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > September 2006 > words selection









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author words selection
Truty

2006-09-02, 6:56 pm

Hi,

Please help me,
I would like to realise a filtre to select only word in file with
caracteres include into this variable $carac_available;
but not caracteres include into this variable $carac_notavailable;

my name file is "dico.txt"

sample with $carac_available = 'eo'; and $carac_notavailable =
'hydngp';
word selected : close, mouve, ... because 'o' and 'e' is include into
this words and 'h', 'y', 'd', 'n', 'g', 'p' is not include into this
words.

content dico.txt :
doing
close
sunny
drugs
mouve
....


my code with problem :
open (FILE_ANSWER,"dico.txt.txt");
while ($ligne = <FILE_ANSWER> ) {
chomp($ligne);
if (($ligne =~ \[$carac_available]\) && ($ligne !~
\[$carac_notavailable]\) ) { print $ligne." | "; }
}
close FILE_ANSWER;



Please, can you please me ?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com