Hi All,
Situation is bit complex (atleast for a beginer like me).
Directory structure is somewhat like this:
 testcases--> 150 Directories (names starting with mixed or green.) ---
> kat.s
i.e. a directrory named testcases has 150 number of directories in it
and each of those 150 number of directories has a file named kat.s .

Now I have to print a single line at say line number 20 in each of 150
number of  kat.s file.
I also have a list of names of all 150 subdirectories in a text file
named "list_of_files".

I have thought of implementing like this:
Open all kat.s in all the 150 directories using "list_of_files" and
print the line(tried as in  code below).
There is some problem in line where I am trying to open kat.s using
dirIN handle.
What am I doing wrong ?
Is there any better approach ?

#########
use strict;
use warnings;
my $file =  'print.txt';
open my $VEDOUT, '>', $file or die "Could not open '$file':  ";

open (VEDIN, 'list_of_files.txt') or die "Cannot open 'File.txt' $!";
my @rgstr=<VEDIN>;

foreach my $file_list (@rgstr) {
  print $file_list ;    #prints file list
open (dirIN, '$file_list/kat.s') or die "Cannot open 'File.txt' $!";
#How to open kat.s ??

###Further have to add the print statement
}
close (VEDIN);
close ($VEDOUT);

##########



Regards
Ved


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to