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]
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
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
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
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
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
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
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
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
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
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
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] ==
"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
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
> -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 " ",
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
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
17 matches
Mail list logo