Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for looking!#!/usr/bin/perl -w use strict; use File::Basename; use File::Slurp qw(read_dir); my $control_file; my @acc_files; my ($path, $name); my @acc_dir = qw( accountdir_a accountdir_b); for my $acc (@acc_dir) { push @acc_files, grep { -f } read_dir( $acc, prefix => 1 ); } open XFILE, ">'$control_file'" or die $!; foreach my $account(@acc_dir) { chomp($account); if($account =~/(.*?)\/([^\/]+)$/) { $path=$1; $name=$2; } # name of the control file here::: ($control_file = $name) =~ s/(\.)([^.]+$)/$1txt/; # creating log file::: print XFILE "$name\n"; } close (XFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: FIle name help!
by wink (Scribe) on Sep 01, 2011 at 03:04 UTC | |
|
Re: FIle name help!
by aaron_baugher (Curate) on Sep 01, 2011 at 20:19 UTC | |
|
Re: FIle name help!
by Lotus1 (Vicar) on Sep 01, 2011 at 15:17 UTC |