How can i use switches type arguments for subroutines in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can i use switches type arguments for subroutines in perl
# 1  
Old 03-23-2012
How can i use switches type arguments for subroutines in perl

i want to call subroutines in perl like:
Code:
      sub temp
      { ---- some code ----- }
      temp(-switchName, value1, --switchName2, value2)

Like i know getoptions::Long is there for command line switches type arguments. So i want to know for subroutine type arguments.
# 2  
Old 03-23-2012
Hi Navrattan Bansa,

I don't understand it. Can you give us any context?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Interpreting arguments in Perl program.

Hello. I'm new to Perl and I am not sure how to interpret command line arguments in the program. I am writing a program similar to the Unix utility 'tail' and need to check if first argument is '-1' (1) or any arbitrary number of lines to output. How would I write an 'if' statement to check for... (4 Replies)
Discussion started by: D2K
4 Replies

2. Homework & Coursework Questions

Help with perl subroutines

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This subroutine needs to check if there was a file name given on the command line. If so, return that. Otherwise... (1 Reply)
Discussion started by: yonkers062986
1 Replies

3. Shell Programming and Scripting

How to get the return code of subroutines executed as standalone as command line in Perl ?

How to do I get the return code of a subroutine in a perl module if invoke the subroutine as standalone, I have an module say TestExit.pm and in that i have a subroutine say myTest() which is returns 12, if i were to call the subroutine from command line like CASE:1 ( Without an explict... (2 Replies)
Discussion started by: ennstate
2 Replies

4. Shell Programming and Scripting

Passing arguments to Perl Function

Hi All, I am trying to pass an argument called "Pricelist" to a Perl function, then the function will open and print out the contents of the file named "Pricelist". But i can't seem to do it using my below code. Can any expert give some advice? #!/usr/local/bin/perl $DATABASE =... (1 Reply)
Discussion started by: Raynon
1 Replies

5. Shell Programming and Scripting

Perl variable type assessment

Hello experts, How we can find out,that what is type of a scalar variable? i.e a scalar var contain a number or a string. Thanks in advance. (8 Replies)
Discussion started by: Zaxon
8 Replies

6. Shell Programming and Scripting

parsing command line switches in Perl

Hi, My perl script takes few switches which i'm parsing through GetOpt::Long module. My script looks like something : myscript.pl --file="foo" --or --file="bar" The --file switch takes 2 arguments foo and bar. The 2 values of file are separated by --or switch. I want to ensure that... (1 Reply)
Discussion started by: obelix
1 Replies

7. Shell Programming and Scripting

Perl data type checking

I am using perl 5.8.0. I need to check some values to see it they are floats. Our system does not have Data::Types so I can't use is_float. Is there something else that I can use? The only thing in Data is Dump.pm. I am not allowed to download anything to our system so I have to use what I have.... (3 Replies)
Discussion started by: ajgwin
3 Replies

8. Shell Programming and Scripting

use perl to get file type ?

Can anybody please tell me how can I determine whether a file is SYMBOLIC LINK, using the stat() function ? So far I have this: my @attrs = stat($fileName); my $mode = $attrs; What next ? (1 Reply)
Discussion started by: the_learner
1 Replies

9. Shell Programming and Scripting

how to get type of variable in perl

hello all how can i get the type of variable in perl like typeof(var); in javascript for instance ? to know if the variable is int or string ? (2 Replies)
Discussion started by: umen
2 Replies

10. Shell Programming and Scripting

determine file type with perl

Hello i will like to know please how can i determine file type inside perl script not using the unix "file" program Thanks allot (1 Reply)
Discussion started by: umen
1 Replies
Login or Register to Ask a Question