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 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 nothing if the parameter contained a * or ? > > I remember having some discussions regarding this and we agreed that > even this should survive the cmdline globbing. Sounds like a little overactive ego on the part of the shell in that case. You're saying that the script in script.pl *.ext file.ext would see an @ARGV of ('*.ext', 'file.ext') if there were no files with this extension, but ('file.ext', 'file1.ext', 'file2.ext', 'file.ext') if all of these (three) files existed? Then how do you pass '*.ext' as ('*.ext') if there are such files? I suppose you can pick up the entire command line (I think?) and process that, but I'm very glad most languages don't do clever 'useful' things with your parameter list before called code gets to see them. > So that you could print > > Cannot open file *.txt > or > No files match the *.txt mask > > > If you happen to have several masks with different meanings it might > be good to be able to say which one did not return anything. > And it may not of course :-) > I was told this is the behaviour of the Unix shells ... > Fine, but rather than have the shell performing obscure gymnastics beneath me I'd rather code it explicitly: for (@ARGV) { print "No files match the $_ mask\n" unless glob }; my @input_files = map glob, @ARGV; > > > From: "Rob Dixon" <[EMAIL PROTECTED]> > > > > my @input_files = map glob, @ARGV; > > There's one more bad thing about this code. Suppose the script was > called like this > > script.pl "hello world.doc" > > then the @ARGV = ( 'hello world') > but the line above will set @input_files to > ( 'hello', 'world.doc' ) Not at all. @ARGV would equal ( "hello world.doc" ) and the statement would set @input_files = ( "hello world.doc" ). > > Not very usefull :-) > Au contraire, just what is wanted :-) Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]