Re: ARGV Error

2011-03-16 Thread John W. Krahn
Shlomi Fish wrote: On Wednesday 16 Mar 2011 17:51:19 ind...@students.itb.ac.id wrote: if(@ARGV != 1){ 1. There should be a space before the "{". There could be, but there doesn't have to be. print "ARGV error \n"; print "firstradar velx vely \n"; You should output errors STD

Re: ARGV Error

2011-03-16 Thread John W. Krahn
Olof Johansson wrote: On 2011-03-16 22:51 +0700, ind...@students.itb.ac.id wrote: if(@ARGV != 1){ print "ARGV error \n"; print "firstradar velx vely \n"; exit(1); } ... I got this error message : ARGV error firstradar velx vely This is your output if the number of arguments

Re: ARGV Error

2011-03-16 Thread Shlomi Fish
Hi Indra, a few comments on your code. On Wednesday 16 Mar 2011 17:51:19 ind...@students.itb.ac.id wrote: > Hi, I am Indra. I am new in perl. > > I start to run my script : > *** > ** > > #!/usr/bin/perl

Re: ARGV Error

2011-03-16 Thread Olof Johansson
On 2011-03-16 17:13 +0100, Olof Johansson wrote: > This is your output if the number of arguments isn't what you > expected. Guessing from > > print "firstradar velx vely \n"; > > you probably want to change > > if(@ARGV != 1){ > > to > > if(@ARGV != 2){ > > as @ARGV is a list and lists

Re: ARGV Error

2011-03-16 Thread Jim Gibson
On 3/16/11 Wed Mar 16, 2011 9:11 AM, "shawn wilson" scribbled: > On Mar 16, 2011 11:53 AM, wrote: >> >> >> if(@ARGV != 1){ >> > > I don't think you can look at an array like its a string like that. > Maybe string( @ARGV ) != 1 might work. But what you probably want is: > If( defined( $ARGV

Re: ARGV Error

2011-03-16 Thread Shawn H Corey
On 11-03-16 12:11 PM, shawn wilson wrote: On Mar 16, 2011 11:53 AM, wrote: if(@ARGV != 1){ I don't think you can look at an array like its a string like that. Maybe string( @ARGV ) != 1 might work. But what you probably want is: If( defined( $ARGV[ 0 ] ) ) No, that is correct. In scala

Re: ARGV Error

2011-03-16 Thread Jim Gibson
On 3/16/11 Wed Mar 16, 2011 8:51 AM, "ind...@students.itb.ac.id" scribbled: > > Hi, I am Indra. I am new in perl. > > I start to run my script : > ** > *** > #!/usr/bin/perl -w > > $UNFOLD = 1; #1=UN

Re: ARGV Error

2011-03-16 Thread Olof Johansson
Hi Indra, On 2011-03-16 22:51 +0700, ind...@students.itb.ac.id wrote: > if(@ARGV != 1){ > print "ARGV error \n"; > print "firstradar velx vely \n"; > exit(1); > } ... > I got this error message : > ARGV error > firstradar velx vely This is your output if the number of arguments is

Re: ARGV Error

2011-03-16 Thread shawn wilson
On Mar 16, 2011 11:53 AM, wrote: > > > if(@ARGV != 1){ > I don't think you can look at an array like its a string like that. Maybe string( @ARGV ) != 1 might work. But what you probably want is: If( defined( $ARGV[ 0 ] ) )

Re: ARGV behaviour in getopts std

2010-01-24 Thread Harry Putnam
"John W. Krahn" writes: >> print "Ditching <$ditch>\n"; >> $ditch = ''; > > What is the point of assigning to $ditch if it goes out of scope at > the next line? > I can only ascribe it to deep seated stupidity What would be the better way to test what the for loop is doing? -- To un

Re: ARGV behaviour in getopts std

2010-01-23 Thread John W. Krahn
Harry Putnam wrote: This is probably blindingly simple but I'm not understanding why @ARGV is not reduced to () (no args)? in this example [ SNIP ] print "Now lets ditch the rest in a for loop\n"; for (@ARGV){ my $ditch = shift; perldoc perlsyn [ SNIP ] Foreach Loops [ SNIP ] Th

Re: ARGV behaviour in getopts std

2010-01-23 Thread Uri Guttman
> "HP" == Harry Putnam writes: HP> print "Now lets ditch the rest in a for loop\n"; HP> for (@ARGV){ change that for to a while. for will create a list of aliases to the array elements passed to it. it doesn't check its length as you seem to think. while will loop until @ARGV is actually

Re: ARGV behaviour in getopts std

2010-01-23 Thread Shawn H Corey
Harry Putnam wrote: > This is probably blindingly simple but I'm not understanding why @ARGV > is not reduced to () (no args)? in this example To Perl, @ARGV is just another array. It has some special features but can be assigned values just like other arrays. You can use it to do tricks, like s

Re: ARGV array regarding

2008-07-31 Thread Mr. Shawn H. Corey
On Thu, 2008-07-31 at 18:00 +0530, suresh kumar wrote: > Hi, > > This is my part of the script, > > if (($#ARGV == 1) && ($ARGV[0] eq "-f")) { >.. > > > if ($ARGV[0] ne "-f" ) { > .. > > > if i run my scr

Re: ARGV array regarding

2008-07-31 Thread Rob Dixon
suresh kumar wrote: > > This is my part of the script, > > if (($#ARGV == 1) && ($ARGV[0] eq "-f")) { >.. > > > if ($ARGV[0] ne "-f" ) { > .. > > > if i run my script i am seeing this kind of warnings. >

Re: $ARGV[0] breaks the script

2006-12-15 Thread Mumia W.
On 12/14/2006 06:24 AM, Gregory Machin wrote: hi the script will not work if I use $ARGV[0] but works 100% if I hard code the $input variable; what have i missed ? #!/usr/bin/perl # if your prgram has the string "grep" in the name or in the path # this program won't work. use strict; use warnin

Re: $ARGV[0] breaks the script

2006-12-15 Thread D. Bolliger
Gregory Machin am Freitag, 15. Dezember 2006 14:05: > On 12/14/06, D. Bolliger <[EMAIL PROTECTED]> wrote: > > Gregory Machin am Donnerstag, 14. Dezember 2006 13:24: [reordered] > > > #!/usr/bin/perl > > > > > > # if your prgram has the string "grep" in the name or in the path > > > # this program

Re: $ARGV[0] breaks the script

2006-12-15 Thread Gregory Machin
Hi thanks for looking at the script.. Just to clarify, the scipt runs perfectly if $input it hardcoded eg $input="httpd". thus if the process is running then it exits, if the process is not running then it exicutes exec "/etc/init.d/$input restart &"; But if I use $input=$ARGV[0] to give the pro

Re: $ARGV[0] breaks the script

2006-12-14 Thread D. Bolliger
Gregory Machin am Donnerstag, 14. Dezember 2006 13:24: > hi Hi Gregory > the script will not work "Not work?" :-) > if I use $ARGV[0] but works 100% if I hard > code the $input variable; > what have i missed ? You can give anything as cmd line argument, and the script will tell you that it i

Re: @ARGV

2005-09-20 Thread Hans Ginzel
Binish A R napsal(a): arguments. Then how come I cannot access the first element with $ARGV[0]? I think @ARGV wont work in command line. Try to write the code in a script and check it out. #!/usr/bin/perl -w print $ARGV[0]; $ perl script.pl arg_1 This returns arg_1 same as c:\>perl -e "

Re: @ARGV

2005-09-18 Thread Binish A R
Hans Ginzel wrote: John W. Krahn napsal(a): arguments. Then how come I cannot access the first element with $ARGV[0]? Are tou not thinking on $0? HG I think @ARGV wont work in command line. Try to write the code in a script and check it out. #!/usr/bin/perl -w print $ARGV[0]; $ per

Re: @ARGV

2005-09-18 Thread Hans Ginzel
John W. Krahn napsal(a): arguments. Then how come I cannot access the first element with $ARGV[0]? Are tou not thinking on $0? HG -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: @ARGV

2005-09-14 Thread John W. Krahn
Christopher Spears wrote: >>From what I understand, @ARGV contains invocation > arguments. Then how come I cannot access the first > element with $ARGV[0]? You can't? > What would be the proper way > to do this? $ perl -le'print $ARGV[0]' one two three four one John -- use Perl; program fu

RE: @ARGV

2005-09-14 Thread Bob Showalter
Christopher Spears wrote: > From what I understand, @ARGV contains invocation > arguments. Then how come I cannot access the first > element with $ARGV[0]? What would be the proper way > to do this? Well, you can access the first element as $ARGV[0], so something else is going on. Show us your c

RE: @ARGV - override

2004-07-08 Thread Bob Showalter
Brian Volk wrote: > Hi All, > > I have a directory full of .txt files that I need to send to > Regexp::Common... I want to over ride the diamond operator by > defining the directory using @ARGV . I'm not sure how I define > it.. Please help, w/o too much laughing! :-) > > -

Re: @ARGV - override

2004-07-08 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: @ARGV = readdir BIN; OTOH, you probably want to exclude at least the '.' and '..' directories, so maybe @ARGV = grep { !/^\./ } readdir BIN; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For add

Re: @ARGV - override

2004-07-08 Thread Gunnar Hjalmarsson
Brian Volk wrote: I have a directory full of .txt files that I need to send to Regexp::Common... I want to over ride the diamond operator by defining the directory using @ARGV . @ARGV = readdir BIN; Just a thought. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To uns

Re: @ARGV

2003-10-01 Thread R. Joseph Newton
"Dillon, John" wrote: > According to > http://vipe.technion.ac.il/~shlomif/lecture/Perl/Newbies/lecture2/argv.html > the following program will do ...whatever (make a backup of files) and it > takes the file specified at the command line. I guessed from this that one > has a .pl file with the fol

Re: @ARGV

2003-09-30 Thread John W. Krahn
John Dillon wrote: > > According to > http://vipe.technion.ac.il/~shlomif/lecture/Perl/Newbies/lecture2/argv.html > the following program will do ...whatever (make a backup of files) and it > takes the file specified at the command line. I guessed from this that one > has a .pl file with the foll

Re: @ARGV

2003-09-30 Thread Steve Grazzini
On Tue, Sep 30, 2003 at 11:03:02AM +0100, Dillon, John wrote: > According to > http://vipe.technion.ac.il/~shlomif/lecture/Perl/Newbies/lecture2/argv.html > the following program will do ...whatever (make a backup of files) and it > takes the file specified at the command line. I guessed from this

Re: @ARGV, -w, use strict;

2003-04-02 Thread Rob Dixon
R. Joseph Newton wrote: > Dan Muey wrote: > > > > > > use: > > >if ( defined $ARGV[0] && ) > > > > Thanks that did it! > > Whoops! Should have read this before I posted. Using defined() will capture a > 0 from STDIN, which could be ameaningful value. Your suggestion is much bet

Re: @ARGV, -w, use strict;

2003-04-02 Thread R. Joseph Newton
Dan Muey wrote: > > > > > > ./test.pl > > > Use of uninitialized value at ./test.pl line 4. > > > HI > > > ./test.pl hi7 > > > hi7 has a number in it > > > HI > > > > use: > >if ( defined $ARGV[0] && ) > > Thanks that did it! > > > Wags ;) Whoops! Should have read this before I

Re: @ARGV, -w, use strict;

2003-04-02 Thread R. Joseph Newton
Dan Muey wrote: > if you do use strict; and a -w switch and you use $ARGV[0] > it says "use of uninitiated value at line ..." if $ARGV[n] is empty > > What do I need to do with @ARGV or $ARGV[n] to make it not give that message? > > > #!/usr/bin/perl -w > use strict; > > if($ARGV[0] =~ /\d/) { pri

RE: @ARGV, -w, use strict;

2003-04-02 Thread Dan Muey
> > > > ./test.pl > > Use of uninitialized value at ./test.pl line 4. > > HI > > ./test.pl hi7 > > hi7 has a number in it > > HI > > use: >if ( defined $ARGV[0] && ) Thanks that did it! > Wags ;) > > > ** > This messa

RE: @ARGV, -w, use strict;

2003-04-02 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Dan Muey wrote: > if you do use strict; and a -w switch and you use $ARGV[0] > it says "use of uninitiated value at line ..." if $ARGV[n] is empty > > What do I need to do with @ARGV or $ARGV[n] to make it not give that > message? > > > #!/usr/bin/perl -w > use strict; > > if($ARGV[0] =~ /\d/)

Re: ARGV

2002-10-27 Thread Mark Goland
Monday, October 28, 2002 2:12 AM Subject: RE: ARGV > Mark - > > Found the file association fix (if you need it): > > My Computer -> tools -> Folder options -> file types > > highlight PL and click 'advanced' > > highlight Open and click edit; be

RE: ARGV

2002-10-27 Thread Beau E. Cox
Mark - Found the file association fix (if you need it): My Computer -> tools -> Folder options -> file types highlight PL and click 'advanced' highlight Open and click edit; be sure the association line looks something like this (correct for your path): "C:\PerlRoot\ActivePerl\bin\perl.exe" "%

RE: ARGV

2002-10-27 Thread Beau E. Cox
Mark - Copied and ran you script exactly as you have shown and it works. I named it t02.pl, so I ran it like: c:> perl t02.pl a b and got a b I am running ActivePerl 5.6.1 on W2K sp3. 1) Did your say 'perl' or just enter the script name? If not, try w/perl. 2) If that is the problem

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
Jenda, Thanks for a very impressive answer. Angus -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: 18 March 2002 12:05 To: Laycock, Angus; [EMAIL PROTECTED] Subject: RE: @ARGV question From: "Laycock, Angus" <[EMAIL PROTECTED]> > $ARGV[$co

RE: @ARGV question

2002-03-18 Thread Jenda Krynicky
From: "Laycock, Angus" <[EMAIL PROTECTED]> > $ARGV[$count] represents the index of the array. I am passing in > parameters and some contain space between two words and I noticed that > using while (<@ARGV>) it loops the exact amount of times per words, > not per parameter. I see. So you wanted

Re: @ARGV question

2002-03-18 Thread Jenda Krynicky
From: "Laycock, Angus" <[EMAIL PROTECTED]> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> Subject:@ARGV question Date sent: Mon, 18 Mar 2002 10:56:39 - > Hi There. > > I have this piece of code which I call with the following;

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
:[EMAIL PROTECTED]] Sent: 18 March 2002 11:34 To: [EMAIL PROTECTED] Subject: RE: @ARGV question > $ARGV[$count] represents the index of the > array. I am passing in parameters and some > contain space between two words and I noticed > that using while (<@ARGV>) it loops the exact >

RE: @ARGV question

2002-03-18 Thread Jonathan E. Paton
> $ARGV[$count] represents the index of the > array. I am passing in parameters and some > contain space between two words and I noticed > that using while (<@ARGV>) it loops the exact > amount of times per words, not per parameter. > So if I passed "Hi There" it goes around the > loop twice rathe

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
oop twice rather than once. On the second iteration there is no value to process. Angus -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: 18 March 2002 11:05 To: [EMAIL PROTECTED] Subject: Re: @ARGV question > while (<$ARGV>) { > print &

Re: @ARGV question

2002-03-18 Thread Jonathan E. Paton
> while (<$ARGV>) { > print "count $count $ARGV[$count]\n"; > $count++; > } What is $ARGV[$count]? Is it supposed to be the line of the file? Either use: my @file = ; foreach my $line (@file) { print 'count' . $count++ . $_ . "\n"; } Or: while () { print "count $. $

Re: @ARGV and getopts

2002-02-08 Thread Michael Fowler
On Fri, Feb 08, 2002 at 08:13:17AM -0600, Pfeiffer, Richard wrote: > My command line looks similar to this: > command.pl-r"z:\Tech Team" -p"/Tools Team" -f"File Found Today.txt" > -v"RDP 1.2_A" > > What I'm trying to check for is to make sure when people run my script, they > have each op

Re: @ARGV and getopts

2002-02-08 Thread Jenda Krynicky
From: "Pfeiffer, Richard" <[EMAIL PROTECTED]> > I have what I think is a trick question and is causing me a bit of > trouble: > > My command line looks similar to this: > command.pl-r"z:\Tech Team" -p"/Tools Team" -f"File Found > Today.txt" -v"RDP 1.2_A" > > What I'm tr

RE: ARGV

2001-12-18 Thread Bob Showalter
> -Original Message- > From: Michael Pratt [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 17, 2001 11:32 PM > To: [EMAIL PROTECTED] > Subject: ARGV > > > I cant seem to get the ARGV to work right via web I get not > found error but > it works via command line. whats the trick? > >

Re: ARGV

2001-12-18 Thread Jon Molin
Michael Pratt wrote: > > I cant seem to get the ARGV to work right via web I get not found error but > it works via command line. whats the trick? > > It works if I do this get_file.pl test1.txt test2.txt > > but it wont work via http://www.host.com/cgi-bin/get_files.pl test1.txt > test2.txt >

Re: ARGV

2001-12-18 Thread Frank
On Mon, Dec 17, 2001 at 10:31:43PM -0600, Michael wrote: > I cant seem to get the ARGV to work right via web I get not found error but > it works via command line. whats the trick? > > It works if I do this get_file.pl test1.txt test2.txt > > but it wont work via http://www.host.com/cgi-bin/get_

Re: $ARGV Help

2001-08-24 Thread register
Maybe you can consider something like this ... after reading in from the ORG file and splitting the elements into @fields ... you can so something along these lines for my $field (@fields) { my $field_length = length($field); my $format = "%-".$field_length

RE: $ARGV

2001-07-05 Thread Chas Owens
$ARGV[0] and $ARGV[1] are not file handles. They are elements of commandline argument array @ARGV. ARGV is a special file handle that holds the current file being read by an empty <> operator. $ARGV is another special variable that holds the name of the file currently being read by an empty <>

RE: $ARGV

2001-07-05 Thread Govinderjit Dhinsa
I have tried to find out in full detail about the file handle $ARGV and only got the basics. Could any one please explain the $ARGV in more detail, e.g. how to put a input file into the $ARGV, if the input file was constantly changing! The File in may program: