CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [manojrayan] Urgent Help: Edit Log



wickedxter
User

Sep 22, 2011, 3:14 PM


Views: 4267
Re: [manojrayan] Urgent Help

 

Code
 
my @words = qw(data set);

open FILE1, "file.txt";
my @file = <FILE1>
close FILE1;

open FILE2, ">>file2.txt";
foreach (@file){
foreach my $word (@words){
if($word eq $_){
print FILE2 uc($_);
}else {
print FILE2 $_;
}
}
}
close FILE2

NOTE: untested this is a baisc attempt this is used for small files to search.

depending on what word your looking for you might have to adjust the if statement to better suit your needs.


(This post was edited by wickedxter on Sep 22, 2011, 3:17 PM)


Edit Log:
Post edited by wickedxter (User) on Sep 22, 2011, 3:14 PM
Post edited by wickedxter (User) on Sep 22, 2011, 3:17 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives