in reply to Re^2: Perl command line switches
in thread Perl command line switches
It seems that you want to find out how your (unformatted) snippet parses the command line:
###################################################################### ###################################################################### sub main { my $gen_public = 0; my $version = "0.1"; while ($arg = shift @ARGV) { $gen_public = 1 if ($arg eq "-p"); if ($arg eq "-v") { $version = shift @ARGV; $XLFILE =~ s/v0\.1/v$version/g; } } # .... rest elided }
You run Perl scripts for example by using perl -w path/to/that/script.pl. Looking at the code, it looks for a -p switch or a -vswitch and sets some variables. All the values from the command line get stuffed into the @ARGV array, see perlvar on that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl command line switches
by Irakro1997 (Novice) on Mar 27, 2020 at 17:01 UTC | |
by Corion (Patriarch) on Mar 27, 2020 at 17:19 UTC | |
by Irakro1997 (Novice) on Mar 27, 2020 at 17:35 UTC | |
by AnomalousMonk (Archbishop) on Mar 27, 2020 at 20:16 UTC | |
by bliako (Abbot) on Mar 27, 2020 at 18:12 UTC | |
by hippo (Archbishop) on Mar 27, 2020 at 19:33 UTC | |
|
Re^4: Perl command line switches
by Irakro1997 (Novice) on Mar 27, 2020 at 17:04 UTC |