Thanks very much. I am not able to print the contents of the file. I'll read about glob and the explanation in the perlop. Thank you!
my $dir = 'input_files';
die "can't opendir $!" unless opendir DIR, $dir;
while (defined(my $file = readdir DIR)) {
do {
print "The directory and file are $dir/$file\n";
die "Can't open input file $!" unless open IN, "< $dir/$file";
use File::Glob ();
while (defined($_ = glob(' IN '))) {
print $_;
}
};
}
closedir DIR;
Output
perl create_indivo_schemas.pl
Name "main::IN" used only once: possible typo at create_indivo_schemas
+.pl line 18.
The directory and file are input_files/allergies
INThe directory and file are input_files/immunizations
INThe directory and file are input_files/..
INThe directory and file are input_files/.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.