Perl :: Getopt::Long in the program


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl :: Getopt::Long in the program
# 1  
Old 07-05-2013
Perl :: Getopt::Long in the program

While going through some of the perl script...

I had found the below line..
Code:
use Getopt::Long;
my $GetOptionsReturnCode = GetOptions (      '<>' => sub { push(@unknownArg, @_);  },    'h|help' => sub {  &helpMessage();  exit 0; },   );

Could anyone please explain the above one ...

Last edited by Scott; 07-10-2013 at 05:16 PM.. Reason: Code tags
# 2  
Old 07-10-2013
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies

2. Programming

Perl Getopt::Long

Hi All I am using Getopt::Long in perl and i am trying to have it so if i dont supply a switch after the progname is will do a defult option i have the following GetOptions($OPT, 'debug|d', 'mail|m', ) or info(); i want it run the debug if it is not given a switch ... (1 Reply)
Discussion started by: ab52
1 Replies

3. Shell Programming and Scripting

How to display a message if program hangs(takes too long)

I have a ksh script (script1) that calls another ksh script (script2). If script2.ksh hangs or takes too long to execute I want script1.ksh to kill the call to script2.ksh and instead just display "Script2 can't run right now". Could someone help me with coding this? (1 Reply)
Discussion started by: mrskittles99
1 Replies

4. Programming

Reading long options in C++ program

I am reading arguments passed to a C++ program which accepts long options. Long options start with '--', with the value joined with the option by an = sign, with no intervening spaces. An example is as follows: programName --vdz=15.0 I want to store 'vdz' in variable 'key', whereas... (4 Replies)
Discussion started by: kristinu
4 Replies

5. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

6. Shell Programming and Scripting

Perl Getopt::Long question - stopping multiple args

Hi there, I have an example basic script (below) and ive been trying to figure out how to stop multiple arguments to my options occuring. for example using the example script below I can issue two arguments for, say the --surname option and it will not barf at me (although thats what i want it to... (11 Replies)
Discussion started by: rethink
11 Replies

7. Shell Programming and Scripting

using getopt for both short and long options

Hi , I am using getopt for both short and long options as below SHORTOPTS="a:c" LONGOPTS="alpha:,charlie" OPTS=$(getopt -o $SHORTOPTS --longoptions $LONGOPTS -n "$progname" -- "$@") eval set -- "$OPTS" while ; do case $1 in -a|--alpha) echo "-a or --alpha... (1 Reply)
Discussion started by: padmisri
1 Replies

8. Shell Programming and Scripting

using getopt for both short and long options

Hi , I am using getopt for both short and long options as below SHORTOPTS="a:c" LONGOPTS="alpha:,charlie" OPTS=$(getopt -o $SHORTOPTS --longoptions $LONGOPTS -n "$progname" -- "$@") eval set -- "$OPTS" while ; do case $1 in -a|--alpha) echo "-a or --alpha... (1 Reply)
Discussion started by: padmisri
1 Replies

9. Shell Programming and Scripting

using getopt for both short and long options

Hi , I am using getopt for both short and long options as below SHORTOPTS="a:c" LONGOPTS="alpha:,charlie" OPTS=$(getopt -o $SHORTOPTS --longoptions $LONGOPTS -n "$progname" -- "$@") eval set -- "$OPTS" while ; do case $1 in -a|--alpha) echo "-a or --alpha... (0 Replies)
Discussion started by: padmisri
0 Replies

10. Shell Programming and Scripting

getopt in perl

Hi, I have a perl script with two functions say func a and func b. sub a { ----------- --------- } sub b { --------- --------- } I want to use this function on command line as we can do in shell script using getopt. My motto here is to run the script like this ... (7 Replies)
Discussion started by: namishtiwari
7 Replies
Login or Register to Ask a Question