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 132007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:11:41+00:00 2026-05-11T06:11:41+00:00

In order to extend my grep emulator in Perl I have added support for

  • 0

In order to extend my ‘grep’ emulator in Perl I have added support for a -r switch which enables recursive searching in sub-directories. Now the command line invocation looks something like this:

perl pgrep.pl -r <directory> <expression> 

Both -r and the directory arguments are optional (directory defaults to ‘.’). As of now I simply check if the first argument is -r and if yes set the appropriate flag, and scan in the rest two arguments using the shift operation. This obviously would be a problem if -r were to appear at the end of the argument list or worse still – in between the directory name and the search expression.

One workaround would be to simply delete the -r item from the @ARGV array so that I can simply shift-in the remaining arguments, but I can’t figure out a way to do it without getting an ‘undef’ in an odd position in my array. Any suggestions or different strategies that you might have used are welcome.

  • 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. 2026-05-11T06:11:42+00:00Added an answer on May 11, 2026 at 6:11 am

    You should be using GetOpt::Long. This will do everything you need as described.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a customoverlay which extend itemizedoverlay in order to place a marker
I wonder which component to extend in Flex 3 in order to make a
For example I have 2 models: Ext.define('Order', { extend : 'Ext.data.Model', fields : [
I have half a dozen classes which all extend the same abstract class. The
I've been trying to extend SimplePie to sort a feed in reverse order. The
Order deny,allow deny from all allow from xx.xx.x.xx RewriteRule . - [F] I have
I have some types that extend a common type, and these are my models.
I have an aggregate root Order with corresponding OrderService and OrderRepository . I have
I've added the following Extensions to my Project in order to create a thread
I have the following two tables as a part of my order processing system:

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.