Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4083786
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:21:26+00:00 2026-05-20T18:21:26+00:00

I am studying and extending a Perl script written by others. It has a

  • 0

I am studying and extending a Perl script written by others. It has a line:

@pub=`ls $sourceDir | grep '\.htm' | grep -v Default |  head  -550`;
foreach (@pub) {

   my $docName = $_;
   chomp($docName);
   $docName =~ s/\.htm$//g;
    ............}

I know that it uses a UNIX command firstly to take out all the htm files, then get rid of file extension.

Now I need to do one thing, which is also very important. That is, I need to change the file name of the actual files stored, by replacing the white space with underscore. I am stuck here because I am not sure whether I should follow his code style, achieving this by using UNIX, or I should do this in Perl? The point is that I need to modify the real file on the disk, not the string which used to hold the file name.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:21:26+00:00Added an answer on May 20, 2026 at 6:21 pm

    It will be faster to use File::Copy to move the file to its new name rather than using this method which forks off a new process, spawns a new shell, etc. it takes more memory and is slower than doing it within perl itself.

    edit.. you can get rid of all that backtick b.s., too, like this

    my @files = grep {!/Default/} glob "$sourcedir/*.html";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am studying an existing Perl program, which includes the following line of code:
I was studying an open source code where I came across the following line
when studying RMI sometimes (head first Java) dudes use Naming.rebind(name, object) but other peoples
After studying the Perl require docs and other links like this on Stackoverflow I'm
Studying C#, my books are showing me classes for readin files. I've found 2
Studying compilers course, I am left wondering why use registers at all. It is
Studying MS Exam 70-536 .Net Foundation I've got to Chapter 11 Application Security and
Just studying the C style of Jon Bentley's Programming Pearls and was wondering if
While studying about JMX, I have seen one of the important feature of it
In studying actionscript 3's graphics class, I've come across the undocumented drawRoundRectComplex() method. It's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.