Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Any help would be greatly appreciated!#! /usr/bin/perl -w $echo="ECHO"; open (DFFILE,$ARGV[0]) || die "DF-file not found\n"; open (LIST,$ARGV[1]) || die "List not found\n"; while (<DFFILE>) { ($value, $key) = split(/\t/, $_); $lijst{$key} = $value; } @listfiles = <LIST>; #print @listfiles; foreach $key (sort keys %lijst) { # print "The value associated with key $key is $lijst{$key}\n"; if ($lijst{$key}==1) { my $word = $key; for $file (@listfiles) { open (FILE,"$file"); open (OUT,">$file.out"); while ($_=<FILE>) { if ($_ =~ m/^$word$/) { $_ =~ s/$word/$echo/g; $_ =~ s/$echo/$word/; } print OUT $_; } close(FILE); close(OUT); } } } close(DFFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with string substitution output
by moritz (Cardinal) on May 23, 2008 at 15:21 UTC | |
by Anonymous Monk on May 23, 2008 at 16:20 UTC | |
by moritz (Cardinal) on May 23, 2008 at 16:26 UTC | |
by Anonymous Monk on May 23, 2008 at 16:39 UTC | |
by moritz (Cardinal) on May 23, 2008 at 16:46 UTC | |
|
Re: problem with string substitution output
by mwah (Hermit) on May 23, 2008 at 16:18 UTC | |
by Anonymous Monk on May 23, 2008 at 16:33 UTC | |
by Anonymous Monk on May 23, 2008 at 19:43 UTC | |
by Anonymous Monk on May 23, 2008 at 20:14 UTC | |
|
Re: problem with string substitution output
by jwkrahn (Abbot) on May 23, 2008 at 20:26 UTC |