glob not working in dos 
Author Message
 glob not working in dos

Hi,
The small test script below works perfectly in unix but produces nothing in
dos.  It shoud list all the files in current directory ending with .c
Any suggestions on why it does not work in dos?
Thanks
Ed

---

#!/usr/bin/perl

my $a;

$a = glob "\*\.c";
for $a(glob "\*\.c")
{
        print"$a\n";

Quote:
}



Tue, 03 May 2005 16:45:01 GMT  
 glob not working in dos

Quote:

> Hi,
> The small test script below works perfectly in unix but produces nothing in
> dos.  It shoud list all the files in current directory ending with .c
> Any suggestions on why it does not work in dos?
> Thanks
> Ed

> ---

> #!/usr/bin/perl

> my $a;

> $a = glob "\*\.c";
> for $a(glob "\*\.c")
> {
>         print"$a\n";
> }

Are you sure it works on unix?  I would have expected glob("*.c") to work but
not glob("\*\.c") unless it was finding a file called *.c . Why are you
escaping the *?

Graham



Tue, 03 May 2005 17:22:44 GMT  
 glob not working in dos


Quote:
> Hi,
> The small test script below works perfectly in unix but produces nothing
in
> dos.  It shoud list all the files in current directory ending with .c
> Any suggestions on why it does not work in dos?
> Thanks
> Ed

> ---

> #!/usr/bin/perl

> my $a;

> $a = glob "\*\.c";
> for $a(glob "\*\.c")
> {
>         print"$a\n";
> }

Works fine for me with ActivePerl 5.6.1 under Windows ME. (I did change the
.c to .pl).  Try again with use strict and use warnings.  Tell us how it
failed.

Bill



Tue, 03 May 2005 17:19:51 GMT  
 glob not working in dos
Hi,
I agree, it should be glob("*.c"), but as an experiment, I tried escaping
the * and the ..  I didn't realized I posted the experiment.  Someone else
has posted that it worked correctly for them in a dos window.  (I presume
they removed my experimental back slashes).  Anyway, I am suspecious of my
perl installation.  I am going to reinstall it.  I am finding that perldoc
is now also not working in dos, but is fine in Unix. In dos, perl -v reports
This is perl, version 5.002.
Thanks for the replies.
Ed


Quote:


> > Hi,
> > The small test script below works perfectly in unix but produces nothing
in
> > dos.  It shoud list all the files in current directory ending with .c
> > Any suggestions on why it does not work in dos?
> > Thanks
> > Ed

> > ---

> > #!/usr/bin/perl

> > my $a;

> > $a = glob "\*\.c";
> > for $a(glob "\*\.c")
> > {
> >         print"$a\n";
> > }

> Are you sure it works on unix?  I would have expected glob("*.c") to work
but
> not glob("\*\.c") unless it was finding a file called *.c . Why are you
> escaping the *?

> Graham



Tue, 03 May 2005 17:46:17 GMT  
 glob not working in dos

Quote:

> I would have expected glob("*.c") to work but
> not glob("\*\.c")

They *must* behave identically, as they have the identical argument.

glob() never sees the backslashes, double quotes eats them first.

Maybe you meant to say "not glob('\*\.c')" instead?

Quote:
> Why are you
> escaping the *?

The * is not being escaped (successfully).

--
    Tad McClellan                          SGML consulting

    Fort Worth, Texas



Wed, 04 May 2005 20:37:01 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. glob not working

2. glob not working through browser

3. glob not working win32?

4. File glob not working properly

5. Open file works under DOS, not under server

6. Simple DOS/Win95 originated Perl script not working when loaded in the UNIX Server

7. Open file works under DOS, not under server

8. Open file works under DOS, not under server

9. Open file works under DOS, not under server

10. Simple DOS/Win95 originated Perl script not working when loaded in the UNIX Server

11. perl glob command and "dos" window

12. Inconsistent results from (dos)glob

 

 
Powered by phpBB® Forum Software