Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: Command-line arguments to command-line Perl

by RecursionBane (Beadle)
on Oct 04, 2010 at 04:57 UTC ( #863249=note: print w/replies, xml ) Need Help??


in reply to Re^3: Command-line arguments to command-line Perl
in thread Command-line arguments to command-line Perl

Thank you, suhailck!

This tactic worked for me; I'd never have thought to use BEGIN() to stall the argument preprocessor until specific args could be gathered before allowing the program to proceed (and thereby still keeping the ability to auto-parse all supplied files "in-line")!

This is what my one-liner now looks like:

perl -pi -e 'BEGIN {$design = pop}; s/'def'.*''/\t"def" => "dumper\/$design.def",/g' ConfigFile ADCIF

The main advantage here is that I can supply "ConfigFile1 ConfigFile2 ... ConfigFileN ADCIF" (or, indeed, "ConfigFile* ADCIF") to have the change applied to all of them. Thanks again for your solution!

~RecursionBane

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863249]
help
Chatterbox?
[Corion]: TCLion: I'm not aware of a better way than manually building the hash, as all strptime incarnations I know have nasty edge cases
[davido]: And remember; time is hard. :) As soon as you think, I've got this, you'll discover that time is harder than that. :)
[1nickt]: TCLion are you parsing the dates with DateTime or another tool?
[1nickt]: I note DateTime::Format:: Flexible, announced immediately below this box in the CPAN feed
[Corion]: 1nickt: That one sounds sensible as it will tell you when it found an error

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2017-03-23 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (287 votes). Check out past polls.