Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > Perl

Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-2006, 09:39 AM
smith smith is offline
Programmer
 
Join Date: Jun 2006
Posts: 108
Rep Power: 9
smith is on a distinguished road
Default Arguments in Perl

How do I accept and manipulate arguments in PERL?

./perlscript.pl $arg1 $arg2


???
__________________
Code:
for (int i;;) {
   cout << "Smith";
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 11-02-2006, 12:47 PM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

Here ya go:-
http://www.devdaily.com/perl/edu/qanda/plqa00001.shtml
is this what you wanted?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-06-2007, 01:36 PM
The Fear The Fear is offline
Newbie
 
Join Date: Jun 2007
Posts: 1
Rep Power: 0
The Fear is on a distinguished road
Default

Hi.
$argv1,$argv2,...
all in @ARGV.
example:
./perl sample.pl $argv1 $argv2
@ARGV = $argv1,$argv2
$ARGV[0] = $argv1
$ARGV[1] = $argv2

#Good luck
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-08-2007, 10:39 PM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 91
Rep Power: 7
KevinADC is on a distinguished road
Default

Quote:
Originally Posted by The Fear View Post
Hi.
$argv1,$argv2,...
all in @ARGV.
example:
./perl sample.pl $argv1 $argv2
@ARGV = $argv1,$argv2
$ARGV[0] = $argv1
$ARGV[1] = $argv2

#Good luck
The above code is not quite correct. Perl sends the arguments to the program in the @ARGV array. You get them back out of the @ARGV array like so:


Code:
my ($arg1,$arg2) = @ARGV;
or:

Code:
my $arg1 = $ARGV[0];
my $arg2 = $ARGV[1];
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl is Dead. Long live Perl. Kernel Programming News 3 08-10-2007 11:49 AM
Move a file in Perl Cosmet Perl 3 02-12-2007 11:43 PM
Left Fill in Perl? Cosmet Perl 4 02-12-2007 07:19 PM
Perl Tutorial Course for Windows priorityone Perl 22 02-11-2007 01:57 AM
Arguments Sionofdarkness Java Help 8 08-23-2006 10:28 PM


All times are GMT -5. The time now is 05:40 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads