sugar has asked for the wisdom of the Perl Monks concerning the following question:
What i have done so far is: (but am not getting the desired results)CASENAME SORTED CLEANED PROCEED case1 yes no no case2 yes yes yes case3 no yes yes case4 no no no
Thank u :)#!/usr/bin/perl open(FILE,'>out.txt') or die $!; if($one eq "option1"){ opendir(DIR,"/home/folders/") or die "can not open directory"; foreach my $line (sort grep !/^\./, readdir DIR){ print FILE "$line|"; opendir(DIR1,"/home/folders/$line"); foreach my $line1 (sort grep !/^\./, readdir DIR1){ if($line1=~/sorted/ && $line1=~/^\w/){print FILE "Yes|";} elsif($line1=~/cleaned/ && $line1=~/^\w/){print FILE "Yes|";} elsif($line1=~/proceed/ && $line1=~/^\w/){print FILE "Yes|";} } print FILE "\n"; } } close (FILE); open(FILE1,'out.txt') or die $!; print "CASENAME SORTED CLEANED PROCEED"; while($ln=<FILE1>){ ($directory,$subdir1,$subdir2,$subdir3)=split(/\|/,$ln); print "\n$directory\t"; if($subdir1 ne "Yes"){print "No\t";}else{print "Yes\t";} if($subdir2 ne "Yes"){print "No\t";}else{print "Yes\t";} if($subdir3 ne "Yes"){print "No\t";}else{print "Yes\t";} } close(FILE1); unlink("out.txt");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: printing the directories...
by moritz (Cardinal) on Oct 23, 2008 at 07:29 UTC | |
by blazar (Canon) on Oct 23, 2008 at 20:51 UTC | |
by moritz (Cardinal) on Oct 23, 2008 at 21:03 UTC | |
by blazar (Canon) on Oct 23, 2008 at 21:14 UTC | |
by sugar (Beadle) on Oct 23, 2008 at 08:25 UTC | |
by johngg (Canon) on Oct 23, 2008 at 10:43 UTC | |
|
Re: printing the directories...
by andreas1234567 (Vicar) on Oct 23, 2008 at 11:39 UTC | |
|
Re: printing the directories...
by jwkrahn (Abbot) on Oct 23, 2008 at 10:49 UTC |