Is there any variable which stores the parameter passed before the actual script name
No. That information is not available anywhere within your perl script.
When you type the command line sudo perl myscript.pl the following steps occur:
Perl is never aware of the original first argument.
However, there are a couple of approaches you might use to discover it:
For example, on windows you could use Win32::Console::ReadRect() to grab the text from the terminal window. You could then search it for the line containing your script name.
With that, most OSs provide a mechanism for finding out the name of the process with that pid.
On windows you might use Win32::Process::Info, or grep the output of the tasklist command.
In reply to Re: Problem in command line arguements
by BrowserUk
in thread Problem in command line arguements
by firearm12
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |