> -----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 " ", @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 loop tries to run anyway.
Right, so you still need the unless clause. I prefer to write it as: unless @ARGV Also, the join can be simplified to "@ARGV" (see perldoc perlvar, search for the $" variable) So that would be: my @input_files = glob "@ARGV" unless @ARGV; But, if your running under a UNIX shell, the arg list has already been globbed, no? Are you running under Win32? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]