Nishi Bhonsle wrote: > I was able to writeout the files on a filesystem to a file C:/filelist.txt > using the program - > > $path = "$ARGV[0]"; > opendir ( DIR, $path ) or die "Can't open $path: $!"; > while(defined($DIR = readdir DIR)) > { > push(@array_A,$DIR) > } > closedir DIR; > open(FILE,">c:/filelist.txt"); > foreach $y (@array_A) > { > print "$y\n"; > print FILE "$y\n"; > } > close FILE; > > Can you please tell me how to modify the above program to ignore the "." > and "..", so that they donot get printed in C:/filelist.txt ?
use warnings; use strict; my $path = $ARGV[ 0 ]; open FILE, '>', 'c:/filelist.txt' or die "Can't open c:/filelist.txt: $!"; opendir DIR, $path or die "Can't open $path: $!"; print FILE map /^\.\.?$/ ? () : "$_\n", readdir DIR; closedir DIR; close FILE; > Can you also let me know how to read the line in the below file, look for > the second and forth " and write the name of the file fetched in the > above program before the second and fourth " and between the fifth and > sixth > " one by one. > > "SL/" "%HOME%/server/bin/" "" NA > as in > "SL/one" "%HOME%/server/bin/one" "one" NA s/("[^"]*)("\s+"[^"]*)("\s+"[^"]*)("\s+NA)/$1$file$2$file$3$file$4/; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>