If you're working on a UNIX system (and I suspect from your task and your code that you are), you might be better off using the
find command to list all of your directories,
then using a (simpler) Perl script to do your processing.
For instance, you could try something like this from the shell:
find /dsmpayroll -type d | perl -n saveinfo.pl
... where
saveinfo.pl reads:
#!/usr/bin/perl -w
use strict;
my $output;
$output .= $_ for ($_, qx/ls -l $_/, qx/lsac */); # Get output for fil
+e
# Print output to file
s!/!.!g; # Generate suitable filename
open FH, ">/home/mis/tstanley/Migrate/$_" or die $!;
print FH $output;
No need to figure out how to pass a function reference (which
dmorelli points out may be the culprit in your original script). More importantly, the
find command allows you to specify many search parameters, something which may be harder to do programmatically with Perl.
Check the manpages for
find (and
perl, if you're unfamiliar with the
-n switch).
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.