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
Hi Edward! On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya [EMAIL PROTECTED] wrote: 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; Good Start! Those

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
Edward Wijaya wrote: Hi, Hello, Why my code below fail to open and print the file contents when I do: perl mycode.pl -f filename __BEGIN__ use strict; use warnings; use Getopt::Std; use vars qw($f); getopts('f:'); getopts( 'f:' ) creates the variable $opt_f and stores the following

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.