I might write something like this: UNTESTED

#!/usr/bin/perl use strict; use warnings; # VARIABLES # Subscriptions Library & Archive Path variables for clarity my $Subscriptions_Path = '/mnt/hgfs'; # Subscription DATA sets my @Subscription = ( { Sub_Name => 'T 1', Lib_Sub_Path => 'VM-Share', Keep_Duration => 0, }, { Sub_Name => 'T 2', Lib_Sub_Path => 'VM-Share/xtr', Keep_Duration => 0, }, { Sub_Name => 'T 3', Lib_Sub_Path => 'VM-Share/xtr 2', Keep_Duration => 0, }, ); for my $curr_sub ( @Subscription ) { print "Beginning Subscription Service for $curr_sub->{Sub_Name}\n" +; chdir "$Subscriptions_Path/$curr_sub->{Lib_Sub_Path}" or do { print "Could not find directory: $Subscriptions_Path/$curr_sub +->{Lib_Sub_Path}\n"; next; }; opendir my $DH, '.' or die "Cannot open directory '$Subscriptions_ +Path/$curr_sub->{Lib_Sub_Path}' because: $!"; while ( my $file = readdir $DH ) { next unless -f $file; my $new = $file; $new =~ s/_/ /g; rename $file, $new or do { print "Could not rename '$file' because: $!"; next; }; } print "Completing Subscription Service for $curr_sub->{Sub_Name}\n +\n"; }
Naked blocks are fun! -- Randal L. Schwartz, Perl hacker

In reply to Re: How to Rename files in multiple directories with a Perl script using an array of hashes. by jwkrahn
in thread How to Rename files in multiple directories with a Perl script using an array of hashes. by ObiPanda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.