From: Nikola Janceski <[EMAIL PROTECTED]>
> Is there a way to get the command line arguments before they are
> expanded by the shell?
>
> script.pl file* names*
>
> I want to get the file* and not the expanded list of file1 file2 file3
> file4 etc.
>
> I know I can put it in quotes but is ther
--Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 5:08 PM
To: Hanson, Robert; Nikola Janceski; Beginners (E-mail)
Subject: RE: command line arguments
I was hoping for some way to capture it in perl instead with out having to
change the co
> "Nikola" == Nikola Janceski <[EMAIL PROTECTED]> writes:
Nikola> Is there a way to get the command line arguments before they
Nikola> are expanded by the shell?
Nope. Perl simply doesn't get to see them. It's part of your
interaction with the shell.
Nikola> I know I can put i
I was hoping for some way to capture it in perl instead with out having to
change the command line arguments.
-Original Message-
From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 5:05 PM
To: 'Nikola Janceski'; Beginners (E-mail)
Subject: RE: co
You should be able to just escape the *. Single quoting them should also
work.
script.pl file\* names\*
script.pl 'file*' 'names*'
Rob
-Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 5:03 PM
To: Beginners (E-mail)
Subject: command lin
[EMAIL PROTECTED] wrote:
>
> This script gives me nothing:
>
> #!/usr/bin/perl -F/\t/ -ap
>
> print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 1816;
^
> print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 5380;
On Tue, 20 Nov 2001 23:50:54 -0500, you wrote:
my @args = @ARGV;
@ARGV contains the command line parameter.
martin
>In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Nicolae Popovici) wrote:
>
>> Hi guys,
>>
>> Can anyone tell me how can I take the command line arguments in a perl
>> scri
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Nicolae Popovici) wrote:
> Hi guys,
>
> Can anyone tell me how can I take the command line arguments in a perl
> script . I forgot how to do it .
> Thanks for your support .
Couple ways.
process a loop around @ARGV...
work with the Modules
The command-line arguments are stored in the built-in @ARGV array.
Therefore, if you say something like :
perl sample.pl argument1 argument2 argument3
then in your program you can access each of the command-line arguments as
follows
print $ARGV[0]; #prints argument1
print $ARGV[1]; #prints arg
On Mon, 4 Jun 2001, Paul <[EMAIL PROTECTED]> wrote,
> --- George Petri <[EMAIL PROTECTED]> wrote:
>
> > "When you launch a script from the command line, for example, @_
> > populates with all of the parameters passed in through the command
> > line"
>
> Typo. @ARGV is correct, as you already
--- George Petri <[EMAIL PROTECTED]> wrote:
> "When you launch a script from the command line, for example, @_
> populates with all of the parameters passed in through the command
> line"
Typo. @ARGV is correct, as you already figured out. =o)
__
On Jun 4, Tony Cook said:
>On Mon, 4 Jun 2001, George Petri wrote:
>
>>
>> In a book called "Open Source Linux Web Porgramming" by Jones and Batchelor,
>> it says (on Page 61):
>
>If your book says this, then it's wrong on 2 counts, both of which you
>seem to have discovered yourself:
Perhaps
Hi George,
Perldoc -f shift gives you:
=item shift ARRAY
=item shift
Shifts the first value of the array off and returns it, shortening the
array by 1 and moving everything down. If there are no elements in the
array, returns the undefined value. If ARRAY is omitted, shifts the
C<@_> array
On Mon, Jun 04, 2001 at 08:02:36PM +, George Petri wrote:
> In a book called "Open Source Linux Web Porgramming" by Jones and
> Batchelor, it says (on Page 61):
>
> "When you launch a script from the command line, for example, @_ populates
> with all of the parameters passed in through the c
George Petri wrote:
> However, if I use "shift @ARGV", I DO get the command line arguments. If the
> shift function really does use @_ as its default argument, then why did shift
> in the example code, use @ARGV as default? Does @_ really get populated
> "with all of the parameters passed in th
On Mon, 4 Jun 2001, George Petri wrote:
>
> Hi!
>
> In a book called "Open Source Linux Web Porgramming" by Jones and Batchelor,
> it says (on Page 61):
>
> "When you launch a script from the command line, for example, @_ populates
> with all of the parameters passed in through the command l
16 matches
Mail list logo