Re: why is if (! @ARGV) skipped

2014-12-06 Thread Harry Putnam
Brandon McCaig bamcc...@gmail.com writes: Hope that helps. Yes it does. Thanks for the continuing review and criticism much needed in my case... -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: why is if (! @ARGV) skipped

2014-11-29 Thread Brandon McCaig
On Fri, Nov 28, 2014 at 9:40 AM, Brandon McCaig bamcc...@gmail.com wrote: # Protip: I'm not sure which is better, interpolating $status # into the format string, or passing it as an argument. I'm # sure it's negligible in this case. printf %-60s $status\n, $abs_path; I lied.

Re: why is if (! @ARGV) skipped

2014-11-28 Thread Brandon McCaig
On Tue, Nov 18, 2014 at 05:46:15PM -0500, Harry Putnam wrote: #!/usr/bin/perl use strict; use warnings; if (!@ARGV) { Alternatively to the @ARGV == 0 suggested by others, there's always: unless(@ARGV) { ... } It's a matter of taste. Nothing really wrong with !@ARGV. usage

Re: why is if (! @ARGV) skipped

2014-11-19 Thread Harry Putnam
quoting in that usage for several version upgrades... maybe a year or longer. You might want to: use Data::Dumper; print Dumper(@ARGV); I'll try try that next time... thanks. Mystery solved by Rob D... I was looking at one script and running a different one. [...] Kent Fredric kentfred

Re: why is if (! @ARGV) skipped

2014-11-19 Thread Harry Putnam
Harry Putnam rea...@newsguy.com writes: Carl Inglis carl.ing...@gmail.com writes: Interesting - in perl 5.10.1 on my system it works as expected. One point to note, your $myscript in your usage should be escaped otherwise you get an error. No. That changed in some previous version a

Re: why is if (! @ARGV) skipped

2014-11-19 Thread Kent Fredric
On 20 November 2014 10:05, Harry Putnam rea...@newsguy.com wrote: , unless I specifically google up some examples of something I believe current advice is not to do that, as there is a vast abundance of very poor/chronically outdated code that may be returned by such a search, or you might

why is if (! @ARGV) skipped

2014-11-18 Thread Harry Putnam
of user forgetting to supply a target directory. The `if (!@ARGV) {[...] bleh; exit}' thing. I'm pretty sure it is some other bit in there causing the grief but I don't understand what. Only thing I did to debug was to make sure `use File::Find; comes after if (!@ARGV), but that seems not to matter

Re: why is if (! @ARGV) skipped

2014-11-18 Thread Carl Inglis
Interesting - in perl 5.10.1 on my system it works as expected. One point to note, your $myscript in your usage should be escaped otherwise you get an error. You might want to: use Data::Dumper; print Dumper(@ARGV); just before your test to see what it thinks @ARGV is actually set

Re: why is if (! @ARGV) skipped

2014-11-18 Thread Kent Fredric
On 19 November 2014 11:46, Harry Putnam rea...@newsguy.com wrote: Only thing I did to debug was to make sure `use File::Find; comes after if (!@ARGV), but that seems not to matter. That will be because 'use' is processed during BEGIN { }, while your condition is during the main execution

Re: why is if (! @ARGV) skipped

2014-11-18 Thread Rob Dixon
on the if clause designed to catch the advent of user forgetting to supply a target directory. The `if (!@ARGV) {[...] bleh; exit}' thing. I'm pretty sure it is some other bit in there causing the grief but I don't understand what. Only thing I did to debug was to make sure `use File::Find; comes after

Re: write to the file whose basename is argv[0]

2012-03-04 Thread lina
my $bib_abbrev, '', $bib_abbrev_filename And here. my $bib_output, '', basename($ARGV[0]).bib Perl won't interpolate function calls inside double-quotes. You can do: open my $bib_output, '', basename($filename) . .bib        or die Foo bar. $!; You can also do @{[basename($filename

Re: write to the file whose basename is argv[0]

2012-03-04 Thread lina
On Sun, Mar 4, 2012 at 2:34 AM, Shawn H Corey shawnhco...@gmail.com wrote: On 12-03-03 11:37 AM, lina wrote: my $tex_filename = $ARGV[0] ; # for catfile() use File::Spec; # divide the input file name into its path and name, # ignore its extension my ( $name, $path ) = fileparse

Re: write to the file whose basename is argv[0]

2012-03-04 Thread Rob Dixon
On 04/03/2012 09:24, lina wrote: On Sun, Mar 4, 2012 at 2:34 AM, Shawn H Coreyshawnhco...@gmail.com wrote: On 12-03-03 11:37 AM, lina wrote: my $tex_filename = $ARGV[0] ; # for catfile() use File::Spec; # divide the input file name into its path and name, # ignore its extension my

Re: write to the file whose basename is argv[0]

2012-03-04 Thread Shawn H Corey
On 12-03-04 04:24 AM, lina wrote: #!/usr/bin/env perl use strict; use warnings; use File::Spec; use File::Basename; my $INPUTFILE = $ARGV[0]; my $tex_filename = $INPUTFILE; my $bib_filename = /home/lina/texmf/bibtex/bib/biophymd.bib; my $bib_abbrev_filename =/home/lina/texmf/bibtex/bib

write to the file whose basename is argv[0]

2012-03-03 Thread lina
$bib_abbrev_filename =/home/lina/texmf/bibtex/bib/biophyabbrev.bib open my $bib_abbrev, '', $bib_abbrev_filename my $bib_output, '', basename($ARGV[0]).bib ### here the ARGV[0] is try.tex, so the output filename is try.bib. my %dict; my $tex_filename = $ARGV[0] ; open my $file, '', $tex_filename or die

Re: write to the file whose basename is argv[0]

2012-03-03 Thread Shlomi Fish
$bib_output, '', basename($ARGV[0]).bib Perl won't interpolate function calls inside double-quotes. You can do: open my $bib_output, '', basename($filename) . .bib or die Foo bar. $!; You can also do @{[basename($filename)]}.bib (using the Turtle operator mentioned here - http://www.catonmat.net

Re: write to the file whose basename is argv[0]

2012-03-03 Thread Shawn H Corey
On 12-03-03 11:37 AM, lina wrote: my $tex_filename = $ARGV[0] ; # for catfile() use File::Spec; # divide the input file name into its path and name, # ignore its extension my ( $name, $path ) = fileparse( $tex_filename, qr/\.[^\.]+$/ ); # create a new name with .bib extension my

ARGV Error

2011-03-16 Thread indrag
$_^[(BCAPPI^[$B$r:n@.^[(B 0=^[$BNJ}$N^[(BCAPPI^[$B$r:n@.^[(B # work directory # $workdir = ..; $datadir = ../volume; $year= 2011; if(@ARGV != 1){ print ARGV error \n; print firstradar velx vely \n; exit(1

Re: ARGV Error

2011-03-16 Thread shawn wilson
On Mar 16, 2011 11:53 AM, ind...@students.itb.ac.id 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 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 isn't what

Re: ARGV Error

2011-03-16 Thread Jim Gibson
$UNFOLD = 1; #1=UNFOLD^[$B%G!%?$r;HMQ^[(B 0=^[$B@8^[(Bvolume^[$B%G!%?$r;HMQ^[(B $XDR_NUM = 1; #1=^[$BJRJ}$N$_^[(BCAPPI^[$B$r:n@.^[(B 0=^[$BNJ}$N^[(BCAPPI^[$B$r:n@.^[(B # work directory # $workdir = ..; $datadir = ../volume; $year= 2011; if(@ARGV != 1){ print ARGV error \n

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,ind...@students.itb.ac.id 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 Error

2011-03-16 Thread Jim Gibson
On 3/16/11 Wed Mar 16, 2011 9:11 AM, shawn wilson ag4ve...@gmail.com scribbled: On Mar 16, 2011 11:53 AM, ind...@students.itb.ac.id 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

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 in scalar

Re: ARGV Error

2011-03-16 Thread Shlomi Fish
=^[$B@8^[(Bvolume^[$B%G!%?$r;HMQ^[(B $XDR_NUM = 1; #1=^[$BJRJ}$N$_^[(BCAPPI^[$B$r:n@.^[(B 0=^[$BNJ}$N^[(BCAPPI^[$B$r:n@.^[(B # work directory # $workdir = ..; $datadir = ../volume; $year= 2011; 1. Add my. 2. Maybe use http://perldoc.perl.org/File/Spec.html if(@ARGV != 1){ 1

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 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 STDERR

Re: ARGV behaviour in getopts std

2010-01-24 Thread Harry Putnam
John W. Krahn jwkr...@shaw.ca 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

ARGV behaviour in getopts std

2010-01-23 Thread Harry Putnam
This is probably blindingly simple but I'm not understanding why @ARGV is not reduced to () (no args)? in this example I'm trying to understand what happens with ARGV in s getops loop with arguments after the getopts Options, or any time there is ARGV, I guess. Why doesn't the `for loop' reduce

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

Re: ARGV behaviour in getopts std

2010-01-23 Thread Uri Guttman
HP == Harry Putnam rea...@newsguy.com 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

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

Re: Totally lost on how to get the argv of Perl

2009-08-24 Thread Andrew Steinborn
Shawn H. Corey wrote: Andrew Steinborn wrote: I need to know how to get the arguments passed to Perl. I'm using the ActiveState built version of Perl on Windows Vista. Perl loads the command-line arguments into the special variable @ARGV See `perldoc perlvar`. Thanks. I figured it out

Re: Totally lost on how to get the argv of Perl

2009-08-24 Thread Telemachus
On Sun Aug 23 2009 @ 9:06, Andrew Steinborn wrote: Shawn H. Corey wrote: Andrew Steinborn wrote: I need to know how to get the arguments passed to Perl. I'm using the ActiveState built version of Perl on Windows Vista. Perl loads the command-line arguments into the special variable @ARGV

Totally lost on how to get the argv of Perl

2009-08-01 Thread Andrew Steinborn
I need to know how to get the arguments passed to Perl. I'm using the ActiveState built version of Perl on Windows Vista. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Totally lost on how to get the argv of Perl

2009-08-01 Thread Shawn H. Corey
Andrew Steinborn wrote: I need to know how to get the arguments passed to Perl. I'm using the ActiveState built version of Perl on Windows Vista. Perl loads the command-line arguments into the special variable @ARGV See `perldoc perlvar`. -- Just my 0.0002 million dollars worth

how can i untain $ARGV from a perl script extending snmp?

2008-10-06 Thread Jordi Moles Blanco
inside the script. so... i want to do things like this: *** my $path = $ARGV[3]; chown 0, 0, /tmp/$path; *** and perl complains that the var is tainted. I perfectly understand that... and all the security reasons to work like that... but 1. how can i untain that var? 2

Re: how can i untain $ARGV from a perl script extending snmp?

2008-10-06 Thread Raymond Wan
Hi Jordi, Jordi Moles Blanco wrote: 1. how can i untain that var? 2. can i modify the way that snmp works to disable that -T flag when it passes the control to the perl script? i've tried to untain the var with any means i've found, like this one: * $path =~ s/;//g; *

Re: how can i untain $ARGV from a perl script extending snmp? [solved]

2008-10-06 Thread Jordi Moles Blanco
En/na Raymond Wan ha escrit: Hi Jordi, Jordi Moles Blanco wrote: 1. how can i untain that var? 2. can i modify the way that snmp works to disable that -T flag when it passes the control to the perl script? i've tried to untain the var with any means i've found, like this one: *

Re: how can i untain $ARGV from a perl script extending snmp?

2008-10-06 Thread Dr.Ruud
Jordi Moles Blanco schreef: my $path = $ARGV[3]; my ($path) = $ARGV[3] =~ m{ ^# SOB (# start capturing (?:# start group / # a slash [a-z]+ # followed by 1 or more lowercase letters

ARGV array regarding

2008-07-31 Thread suresh kumar
Hi, 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. Use of uninitialized value in string eq

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. Use

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 script i am seeing

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 process

Re: $ARGV[0] breaks the script

2006-12-15 Thread D. Bolliger
. use strict; use warnings; my $line; my $input; $input=$ARGV[0]; #$input=httpd; chomp $input; open PROS, ps -ef|grep $input |; while ($line = PROS){ unless ($line =~ m/grep/){ print $input is running\n; exit; } } print $input isn't running\n

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

$ARGV[0] breaks the script

2006-12-14 Thread Gregory Machin
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 warnings; my $line; my $input; $input=$ARGV[0

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

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 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] http://learn.perl.org/ http://learn.perl.org/first-response

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

@ARGV

2005-09-14 Thread Christopher Spears
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? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http

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 code

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

calling an invocation argument from @ARGV

2005-02-25 Thread Christopher Spears
I'm trying to automate g++ through a Perl script. Here is what I have written so far: #!/bin/perl -w use strict; my $counter; $counter = 0; for (my $i = 0; $i @ARGV; $i++) { $counter++; } if ($counter == 0) { print Not enough arguments!; print Usage: ./cedit somefile.C

RE: calling an invocation argument from @ARGV

2005-02-25 Thread Larsen, Errin M HMMA/IT
necessary to initialize this variable. It doesn't hurt, but it's just a line you didn't need to type. for (my $i = 0; $i @ARGV; $i++) { $counter++; } ## This whole loop is not needed. If you use the @ARGV variable in a Scalar context, it will report how many elements it has my

RE: calling an invocation argument from @ARGV

2005-02-25 Thread Larsen, Errin M HMMA/IT
SNIP #!/bin/perl -w use strict; ## you should: use warnings; ## it will help you in the future SNIP Oops! I just realized your using that '-w' switch to perl up there. That IS using the warnings pragma, I believe. Sorry about that! --Errin -- To unsubscribe, e-mail:

Re: calling an invocation argument from @ARGV

2005-02-25 Thread John W. Krahn
Christopher Spears wrote: I'm trying to automate g++ through a Perl script. Here is what I have written so far: #!/bin/perl -w use strict; my $counter; $counter = 0; for (my $i = 0; $i @ARGV; $i++) { $counter++; } You don't need a loop for that as an array in scalar context returns

Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Edward Wijaya
Hi, Why my code below fail to open and print the file contents when I do: perl mycode.pl -f filename Regards, Edward WIJAYA SINGAPORE __BEGIN__ use strict; use warnings; use Getopt::Std; use vars qw($f); getopts('f:'); my $f = $ARGV[0]; open ( INFILE, '', $f) or die $0 : failed to open

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Errin Larsen
, you should have declared opt_f here: our $opt_f; getopts('f:'); my $f = $ARGV[0]; open ( INFILE, '', $f) or die $0 : failed to open input file $f : $!\n; This is good, I especially like the 'die' statement in case it fails. Good Job! It is relevant to note that opening

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Errin Larsen
Hi again, Edward! Just so you know, you should CC the list when you reply! On Tue, 28 Sep 2004 22:26:55 +0800, Edward Wijaya [EMAIL PROTECTED] wrote: Thanks Errin, It works just as you suggested. Thanks so much for your thorough explanation. Glad that I learnt much from it. Edward, I

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Chris Devers
On Tue, 28 Sep 2004, Errin Larsen wrote: On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya [EMAIL PROTECTED] wrote: use vars qw($f); The above is good, but is now obsolete. That is debatable. Gather round, and listen to the story of a log handling utility written in perl,

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Errin Larsen
On Tue, 28 Sep 2004 15:26:08 -0400 (EDT), Chris Devers [EMAIL PROTECTED] wrote: On Tue, 28 Sep 2004, Errin Larsen wrote: On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya [EMAIL PROTECTED] wrote: use vars qw($f); The above is good, but is now obsolete. That is debatable.

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread John W. Krahn
argument 'filename' in that variable and *REMOVES* those arguments from @ARGV so that @ARGV is now empty. my$f = $ARGV[0]; Since @ARGV is now empty, $f is also empty (undef). open ( INFILE, '', $f) or die $0 : failed to open input file $f : $!\n; close ( INFILE ); while ( ) Since

RE: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Bob Showalter
Errin Larsen wrote: So, what was the justification for changing 'use vars' to 'our'? I don't know, but I suspect it's because our is a complement to my. Same syntax (no silly qw() business), same lexical scoping, etc. You're correct. our() should be used and 'use vars' should be considered

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Wiggins d Anconia
On Tue, 28 Sep 2004, Errin Larsen wrote: On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya [EMAIL PROTECTED] wrote: use vars qw($f); The above is good, but is now obsolete. That is debatable. Please, beginners, recognize the above word, *debatable*!! I disagree with the

Re: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Chris Devers
On Tue, 28 Sep 2004, Wiggins d Anconia wrote: On Tue, 28 Sep 2004, Chris Devers wrote: On Tue, 28 Sep 2004, Errin Larsen wrote: On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya [EMAIL PROTECTED] wrote: use vars qw($f); The above is good, but is now obsolete.

RE: perl crashing at $image-Read (file= \*ARGV);

2004-09-13 Thread Brian Volk
, 2004 10:18 AM To: 'Beginners (E-mail)' Subject: RE: perl crashing at $image-Read (file= \*ARGV); Wiggins d'Anconia wrote: It appears that the docs for I::M are incorrect and that CRead and CWrite must take a filehandle. Difficult to tell since all the code is XS/C and I didn't feel like popping

RE: perl crashing at $image-Read (file= \*ARGV);

2004-09-13 Thread Brian Volk
); undef $img; } } Thanks for any help! Brian -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 6:32 PM To: Brian Volk Cc: Beginners (E-mail) Subject: Re: perl crashing at $image-Read (file= \*ARGV); Please

perl crashing at $image-Read (file= \*ARGV);

2004-09-09 Thread Brian Volk
Hi All, I my perl script is crashing perl at this line; $image-Read (file= \*ARGV); I know that it is this line because I have commented out everything else around it. When I just have the Read statment, perl will crash. Here is the script, can someone please suggest what I am doing

Re: perl crashing at $image-Read (file= \*ARGV);

2004-09-09 Thread Wiggins d Anconia
Hi All, I my perl script is crashing perl at this line; $image-Read (file= \*ARGV); I know that it is this line because I have commented out everything else around it. When I just have the Read statment, perl will crash. Here is the script, can someone please suggest what I am

Re: perl crashing at $image-Read (file= \*ARGV);

2004-09-09 Thread Wiggins d'Anconia
will chime in ... http://danconia.org -Original Message- From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 12:28 PM To: Brian Volk; Beginners (E-mail) Subject: Re: perl crashing at $image-Read (file= \*ARGV); Hi All, I my perl script is crashing perl

RE: perl crashing at $image-Read (file= \*ARGV);

2004-09-09 Thread Brian Volk
: Thursday, September 09, 2004 12:28 PM To: Brian Volk; Beginners (E-mail) Subject: Re: perl crashing at $image-Read (file= \*ARGV); Hi All, I my perl script is crashing perl at this line; $image-Read (file= \*ARGV); I know that it is this line because I have commented out everything

@ARGV - override

2004-07-08 Thread Brian Volk
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! :-) - the start

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

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

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

different argv behavior in different machines

2004-06-24 Thread PerlDiscuss - Perl Newsgroups and mailing lists
I am a new perl user and I am running into a problem. I am trying to use argv and it's not returning the correct response on my laptop, but it's working fine on another machine. The only difference between the two machines is that on my laptop, I first installed the perl AS package for windows

Re: different argv behavior in different machines

2004-06-24 Thread Beau E. Cox
On Wednesday 23 June 2004 10:22 am, PerlDiscuss - Perl Newsgroups and mailing lists wrote: I am a new perl user and I am running into a problem. I am trying to use argv and it's not returning the correct response on my laptop, but it's working fine on another machine. The only difference

RE: Confused about supplying command line arguments and using @ARGV

2004-06-04 Thread Larry Wissink
: Thursday, June 03, 2004 5:30 AM To: Larry Wissink Cc: [EMAIL PROTECTED] Subject: Re: Confused about supplying command line arguments and using @ARGV On Jun 2, Larry Wissink said: I want to supply the name of a file on the command line when executing a script. Unfortunately, I'm getting an error

Re: Confused about supplying command line arguments and using @ARGV

2004-06-04 Thread David Kirol
ActiveState on windoze requires some 'extra fiddling' to get the command line params to actually make it into @ARGV On my winnt box I followed the directions ActiveState provided under 'Windows Quirks' under the getting started section Basicall you modify the .pl file extension from {full path

Re: Confused about supplying command line arguments and using @ARGV

2004-06-04 Thread Jenda Krynicky
From: Dennis G. Wicks [EMAIL PROTECTED] I just did extensive testing using ActiveState perl on XP-Pro and I get the exact same results. C:\DATAFI~1argv.pl testfile gives the unitialized variable message but C:\DATAFI~1perl argv.pl testfile works as expected. It ain't bug in

Confused about supplying command line arguments and using @ARGV

2004-06-03 Thread Larry Wissink
Hi, I thought this would be simple... I want to supply the name of a file on the command line when executing a script. Unfortunately, I'm getting an error that says that @ARGV is uninitialized. How do you initialize @ARGV? How do you specify command line arguments? I'm using Windows XP

Re: Confused about supplying command line arguments and using @ARGV

2004-06-03 Thread Jeff 'japhy' Pinyan
On Jun 2, Larry Wissink said: I want to supply the name of a file on the command line when executing a script. Unfortunately, I'm getting an error that says that @ARGV is uninitialized. How do you initialize @ARGV? How do you specify command line arguments? You don't initialize @ARGV

Re: Confused about supplying command line arguments and using @ARGV

2004-06-03 Thread Dennis G. Wicks
[EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Larry Wissink [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Confused about supplying command line arguments and using @ARGV On Jun 2, Larry Wissink said: I want to supply the name of a file on the command line when executing

Re: perl -ne 'if(/rcn/) {print $ARGV: $_ unless -d}' *

2003-12-03 Thread Jerry Rocteur
On Tuesday, Dec 2, 2003, at 21:06 Europe/Brussels, John W. Krahn wrote: Jerry Rocteur wrote: Hi, Hello, I'm trying to use perl for most shell stuff and this is some of the stuff I'm using for grep .. perl -ne 'print $ARGV: $_ if /jerry/i ' * perl -ne 'print if /jer{1,}y/i ' * perl -ne 'print

perl -ne 'if(/rcn/) {print $ARGV: $_ unless -d}' *

2003-12-02 Thread Jerry Rocteur
Hi, I'm trying to use perl for most shell stuff and this is some of the stuff I'm using for grep .. perl -ne 'print $ARGV: $_ if /jerry/i ' * perl -ne 'print if /jer{1,}y/i ' * perl -ne 'print unless /jer{1,}y/i ' * I'm enjoying this as I can do a lot more than I can with the old egrep

Re: perl -ne 'if(/rcn/) {print $ARGV: $_ unless -d}' *

2003-12-02 Thread david
Jerry Rocteur wrote: Hi, I'm trying to use perl for most shell stuff and this is some of the stuff I'm using for grep .. perl -ne 'print $ARGV: $_ if /jerry/i ' * perl -ne 'print if /jer{1,}y/i ' * perl -ne 'print unless /jer{1,}y/i ' * I'm enjoying this as I can do a lot more than

Re: perl -ne 'if(/rcn/) {print $ARGV: $_ unless -d}' *

2003-12-02 Thread John W. Krahn
Jerry Rocteur wrote: Hi, Hello, I'm trying to use perl for most shell stuff and this is some of the stuff I'm using for grep .. perl -ne 'print $ARGV: $_ if /jerry/i ' * perl -ne 'print if /jer{1,}y/i ' * perl -ne 'print unless /jer{1,}y/i ' * I'm enjoying this as I can do a lot

Re: @ARGV

2003-10-01 Thread R. Joseph Newton
. use strict; my $filename = $ARGV[0]; open I, .$filename; open O, .$filename..bak; print O join(,I); close(I); close(O); Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

@ARGV

2003-09-30 Thread Dillon, John
: by typing its name and then the program stops and asks you what file you want to specify. But this does not happen. So how do you get the filename into the script? use strict; my $filename = $ARGV[0]; open I, .$filename; open O, .$filename..bak; print O join(,I); close(I); close(O

Recall: @ARGV

2003-09-30 Thread Dillon, John
Dillon, John would like to recall the message, @ARGV. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: @ARGV

2003-09-30 Thread Steve Grazzini
this that one has a .pl file with the following script, execute it at c: by typing its name and then the program stops and asks you what file you want to specify. But this does not happen. So how do you get the filename into the script? use strict; my $filename = $ARGV[0]; open I, .$filename

Re: @ARGV

2003-09-30 Thread John W. Krahn
= $ARGV[0]; The @ARGV array contains the contents of the command line after the program name. C:\ program.pl -f filename 2 3 # $0 contains 'program.pl' or 'c:\program.pl' # #ARGV[0] contains '-f' # #ARGV[1] contains 'filename' # #ARGV[2] contains '2' # #ARGV[3] contains '3' open I, .$filename

using @ARGV to get user-defined arguments

2003-05-28 Thread cbgb
ATM I can use @ARGV by forcing it to read specified files (see sample below). But how can I turn it into a subroutine that accepts any filenames and can be called within a script, eg: myroutine(fileA,fileB) ? thanks Chris #!/usr/bin/perl -Tw @ARGV=(textfile,craig); foreach $arg (@ARGV

using @ARGV to get user-defined arguments

2003-05-28 Thread cbgb
---apologies if this turns out to be a double-posting--- ATM I can use @ARGV by forcing it to read specified files (see sample below). But how can I turn it into a subroutine that accepts any filenames and can be called within a script, eg: myroutine(fileA,fileB) ? thanks Chris #!/usr/bin/perl

RE: using @ARGV to get user-defined arguments

2003-05-28 Thread Bob Showalter
cbgb wrote: ATM I can use @ARGV by forcing it to read specified files (see sample below). But how can I turn it into a subroutine that accepts any filenames and can be called within a script, eg: myroutine(fileA,fileB) ? thanks Chris #!/usr/bin/perl -Tw @ARGV=(textfile,craig

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/) { print $ARGV[0

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 posted. Using defined

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 better than mine

  1   2   >