Re: glob subtlety question

2003-01-03 Thread David Eason
The following has the same output as John's way: my @Bobs_way = glob "@ARGV" unless ! @ARGV; print "Bob\'s way:\n"; for $arg (@Bobs_way) {print "- $arg\n";}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: glob subtlety question

2003-01-03 Thread Jenda Krynicky
From: "David Eason" <[EMAIL PROTECTED]> > A little background on my question. > > Basically I want people to be able to say something like > prog page*.html morebookmarks.html > > For Unix users, I want to be lazy and have the shell glob that for me. > For Windows users, I want to be lazy and h

Re: glob subtlety question

2003-01-03 Thread David Eason
A little background on my question. Basically I want people to be able to say something like prog page*.html morebookmarks.html For Unix users, I want to be lazy and have the shell glob that for me. For Windows users, I want to be lazy and have the perl function glob that for me. Q1. Could the

Re: glob subtlety question

2003-01-02 Thread R. Joseph Newton
Hi, If I get the concept of globbing properly, I have been able to prevent it in Unix by quoting my parameter list. I'm not sure how this works for spaces, but it helps a lot with CGI stuff. When I do this, I use an test for STDIN, and if its not preloaded, take @ARGV from the command-line as

Re: glob subtlety question

2003-01-01 Thread Jenda Krynicky
From: "Rob Dixon" <[EMAIL PROTECTED]> > "Jenda Krynicky" <[EMAIL PROTECTED]> wrote in message > 3E1349E5.27703.3CB576EE@localhost">news:3E1349E5.27703.3CB576EE@localhost... > > From: "Rob Dixon" <[EMAIL PROTECTED]> > > > But glob 'absent_file.txt' returns ('absent_file.txt') so I think > > > this d

Re: glob subtlety question

2003-01-01 Thread Rob Dixon
Hi Jenda See in-line. "Jenda Krynicky" <[EMAIL PROTECTED]> wrote in message 3E1349E5.27703.3CB576EE@localhost">news:3E1349E5.27703.3CB576EE@localhost... > From: "Rob Dixon" <[EMAIL PROTECTED]> > > But glob 'absent_file.txt' returns ('absent_file.txt') so I think this > > does what's required. As

Re: glob subtlety question

2003-01-01 Thread Jenda Krynicky
From: "Rob Dixon" <[EMAIL PROTECTED]> > But glob 'absent_file.txt' returns ('absent_file.txt') so I think this > does what's required. As perldoc says, glob EXPR returns the value of > EXPR with filename expansions such as the standard Unix shell /bin/csh > would do. I see ... it only returns noth

Re: glob subtlety question

2003-01-01 Thread Rob Dixon
But glob 'absent_file.txt' returns ('absent_file.txt') so I think this does what's required. As perldoc says, glob EXPR returns the value of EXPR with filename expansions such as the standard Unix shell /bin/csh would do. Whether this behaviour is a Good Thing is a separate question though, and pu

Re: glob subtlety question

2002-12-31 Thread Jenda Krynicky
From: "Rob Dixon" <[EMAIL PROTECTED]> > Sorry to drag this one up again, but it doesn't seem to have been > answered properly. Surely the answer is: > > my @input_files = map glob, @ARGV; > > which will also leave @input_files empty if @ARGV is empty. The problem is that it will also glob th

Re: glob subtlety question

2002-12-31 Thread Rob Dixon
Sorry to drag this one up again, but it doesn't seem to have been answered properly. Surely the answer is: my @input_files = map glob, @ARGV; which will also leave @input_files empty if @ARGV is empty. Cheers all, Rob "David Eason" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">n

Re: glob subtlety question

2002-12-31 Thread David Eason
Thanks to all! "David Eason" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there a better way to say: > > my @input_files = glob (join " ", @ARGV) unless $#ARGV = -1; > foreach my $doc ( @input_files ) { ... __code goes here___ } > > I put the unless clause

Re: glob subtlety question

2002-12-17 Thread Jenda Krynicky
From: "David Eason" <[EMAIL PROTECTED]> > Is there a better way to say: > > my @input_files = glob (join " ", @ARGV) unless $#ARGV = -1; > foreach my $doc ( @input_files ) { ... __code goes here___ } use G; # http://Jenda.Krynicky.cz/#G my @input_files = @ARGV; Jenda = [EMAIL PROTECTED] ==

Re: glob subtlety question

2002-12-16 Thread John W. Krahn
"John W. Krahn" wrote: > > David Eason wrote: > > > > Is there a better way to say: > > > > my @input_files = glob (join " ", @ARGV) unless $#ARGV = -1; > > foreach my $doc ( @input_files ) { ... __code goes here___ } > > > > I put the unless clause in there because otherwise... > > if there are

Re: glob subtlety question

2002-12-16 Thread John W. Krahn
David Eason wrote: > > Is there a better way to say: > > my @input_files = glob (join " ", @ARGV) unless $#ARGV = -1; > foreach my $doc ( @input_files ) { ... __code goes here___ } > > I put the unless clause in there because otherwise... > if there are no file arguments, @input_files ends up h

RE: glob subtlety question

2002-12-16 Thread Bob Showalter
> -Original Message- > From: David Eason [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 14, 2002 9:53 PM > To: [EMAIL PROTECTED] > Subject: glob subtlety question > > > Is there a better way to say: > > my @input_files = glob (join " ",

Re: glob subtlety question

2002-12-16 Thread David Eason
OOPS. I meant unless $#ARGV == -1 "David Eason" <[EMAIL PROTECTED]> wrote in message news:... > Is there a better way to say: > > my @input_files = glob (join " ", @ARGV) unless $#ARGV = -1; > foreach my $doc ( @input_files ) { ... __code goes here___ } > > I put the unless clause in there because

glob subtlety question

2002-12-16 Thread David Eason
Is there a better way to say: my @input_files = glob (join " ", @ARGV) unless $#ARGV = -1; foreach my $doc ( @input_files ) { ... __code goes here___ } I put the unless clause in there because otherwise... if there are no file arguments, @input_files ends up having an element [0] And the foreach