The array @ARGV holds the arguments you've passed to the script. So it's not that hard to handle this. Just add
my $extra_args; if ($ARGV[0] eq "/y") { $extra_args = "/y"; } system ("C:\\WINDOWS\\System\\deltree.exe $extra_args) and die "Couldn +'t delete tree: $!\n";
That's pretty basic, though, and not terribly extensible; depending on the other features you want to add, you might step up to Getopt::Std or Getopt::Long to process command-line arguments. To extend things as they are, look into turning @ARGV into a space-separated string so you can pass a whole bunch of arguments to the deltree command. (I'll leave that up to you, as a nice learning exercise).
Also note: die STRING is handier than print STDERR STRING. Furthermore, since you're on Windows (evidently) your #! line is nonsensical (but, in the current context, harmless).
HTH
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
In reply to Re: help adding a paramter to an executable i am running
by arturo
in thread help adding a paramter to an executable i am running
by rimuladas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |