At 10:32 AM -0800 12/16/99, george rosenberg wrote: >Dear MacPerl Experts' > >i'm trying to read the contents of files in a folder and add it to a single >file. > >i'm able to read the file names in the folder > >but i can not read the contents of the files. > >it appears that i am at the wrong dir level. Well, then, move to the right dir level with chdir. Your problem is a common one. opendir() and readdir() do *not* move you into the directory they are reading, and only return file names, not full paths to the files. So you need a chdir: > >if i move a file out of its folder i can read it! > >here is my code: > >#!perl > >print ("What is the name of your folder? "); > >$myFOLDER = <STDIN> ; >chomp($myFOLDER); > >print ("you picked folder $myFOLDER \n"); > >open(mydata, "+>fas_seq") or die ('Could not make file'); > >opendir(DIR, "$myFOLDER") or die " could not open $myFOLDER"; >@files = readdir(DIR); >closedir(DIR); chdir($myFOLDER) or die "Unable to chdir"; >foreach $file (@files) { > print("$file\n"); > print mydata (">$file\n"); > > open(IN, "$file") or die ("could not open file $file"); > > while( $_ = <IN> ){ > > print "$_"; > print mydata "$_"; > } > > close(IN); > > } > >close(mydata); > >here is the error: > ># could not open file 09 R2S3-REV, <STDIN> chunk 1. > >any advise? > >thank you very much. > -- Paul Schinder schinder@pobox.com # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org