kevyt has asked for the wisdom of the Perl Monks concerning the following question:
# version 1.0 use warnings; use strict; use Shell; 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 "Hello $_"; } while (<IN>){ # Reading contents of file next if (/^#/); $file(); ##### File name can be many things print "Bye " . $_ ; } }; } closedir DIR; sub allergies { print "in allergies\n"; } sub immunizations { print "in immunizations\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to call a Sub / Function with changing name
by choroba (Cardinal) on Oct 28, 2010 at 22:19 UTC | |
by kevyt (Scribe) on Oct 28, 2010 at 22:46 UTC | |
by kevyt (Scribe) on Oct 29, 2010 at 00:21 UTC | |
by ig (Vicar) on Oct 29, 2010 at 01:17 UTC | |
by kevyt (Scribe) on Oct 29, 2010 at 16:23 UTC | |
by kevyt (Scribe) on Oct 28, 2010 at 22:24 UTC | |
|
Re: How to call a Sub / Function with changing name
by Marshall (Canon) on Oct 28, 2010 at 22:30 UTC | |
|
Re: How to call a Sub / Function with changing name
by kcott (Archbishop) on Oct 29, 2010 at 01:08 UTC | |
|
Re: How to call a Sub / Function with changing name
by aquarium (Curate) on Oct 29, 2010 at 02:31 UTC |