Hello all,
I tried modifying the open command ar suggested and got the enclosed
errors. Also, I'm working with Activestate Activeperl 5.6 on a Windows
2000. Also, from the syntax of the readdir example, the test is to the
left of the readdir command. Does this mean I should place my file
processing block to the left of the readdir command. That would be one
ugly statement.
Thanks for all the help.
-Ganesh
snippet:
use warnings;
use strict;
my @files = ();
my $folder = 'input';
# Open the input folder
unless (opendir(FOLDER, $folder)) {
print "Cannot open folder $folder!\n\n";
exit;
}
#read the contents of the folder (files and subfolders)
chdir($folder); #added this line after failing with open commands below.
print "Switching to folder $folder!\n\n"; # It's going to the correct
folder
@files = readdir(FOLDER);
#Close the folder
print "\n\n Here are the files in the folder\n";
#print out the filenames, one per line
print join( "\n", @files), "\n";# Prints out correct filenames
closedir(FOLDER);
foreach my $seqfilename (@files){
$seqfilename = '';
open (TXTFILE,"<$seqfilename") or die $!; #dies on this line.Replace with
open (TXTFILE,"<$folder/$seqfilename") or die $!; #Invalid argument at this
line. Replace with
open (TXTFILE,"<$folder\$seqfilename") or die $!; #No such file or directory
error at this line
close TXTFILE;
my @seqelements = <TXTFILE>;
...........goes on from here
I know the conversion routine works, because it worked
when I specified a single file
--
Ganesh Shankar
[EMAIL PROTECTED]
--
http://www.fastmail.fm - Or how I learned to stop worrying and
love email again
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]