maurkb has asked for the wisdom of the Perl Monks concerning the following question:
#!/Usr/local/bin/perl; use Tie::File; use Getopt::Long; use warnings; #string to search for my($target1) = '6169600047'; #files and directories my($indir) = "c:/FAMD_EDI"; my($outdir) = "c:/FAMD_EDI"; my($outfile) = "FAMD_EDI_Master.txt"; open(OUTDIR, $outdir); open(OUTFILE,">$outdir/$outfile") or die "Cannot create output File"; opendir(MYDIR, $indir) or die "can't open dir $indir: $!"; while (defined($infile = readdir(MYDIR))) { next if $infile =~ /^\.\.?$/; open(FILEHNDL, "$indir/$infile") or die "Cannot open input file $!" +; while ($line = <FILEHNDL>) { chomp($line); #print "line= $line\n"; @cols = split(/|/, $line); if ($cols[11] = $target1) { #complete processing } } close(FILEHNDL); } close(OUTFILE); closedir(MYDIR);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using split
by FunkyMonk (Bishop) on Jun 04, 2007 at 16:10 UTC | |
by maurkb (Novice) on Jun 04, 2007 at 16:29 UTC | |
|
Re: using split
by GrandFather (Saint) on Jun 04, 2007 at 21:19 UTC | |
by naikonta (Curate) on Jun 05, 2007 at 02:21 UTC | |
by GrandFather (Saint) on Jun 05, 2007 at 03:26 UTC | |
by educated_foo (Vicar) on Jun 04, 2007 at 21:42 UTC | |
by GrandFather (Saint) on Jun 04, 2007 at 23:56 UTC | |
by educated_foo (Vicar) on Jun 05, 2007 at 15:09 UTC | |
by GrandFather (Saint) on Jun 05, 2007 at 19:41 UTC | |
|
Re: using split
by lidden (Curate) on Jun 04, 2007 at 22:19 UTC | |
by FunkyMonk (Bishop) on Jun 04, 2007 at 22:31 UTC | |
by naikonta (Curate) on Jun 05, 2007 at 02:02 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |