glob question

S

s99999999s2003

hi
i have a piece of perl code like this

....
print "$globbed\n" ; # this output gives *.txt
process($globbed);

....

sub process {
my $pattern = $_[0];
while ( glob $pattern ) {
....

}

}
when the sub process is executed, i have an error
" glob failed (child exited with status 1) "

thanks very much for any help rendered :)
 
X

xhoster

hi
i have a piece of perl code like this

...
print "$globbed\n" ; # this output gives *.txt
process($globbed);

...

sub process {
my $pattern = $_[0];
while ( glob $pattern ) {
....

}

}
when the sub process is executed, i have an error
" glob failed (child exited with status 1) "

thanks very much for any help rendered :)

What version of Perl? OS?
What if you change the while to a foreach?

Maybe this is relevant:
Is there a leak/bug in glob()?

Due to the current implementation on some operating systems,
when you use the glob() function or its angle-bracket alias
in a scalar context, you may cause a memory leak and/or
unpre- dictable behavior. It's best therefore to use glob()
only in list context.

Xho
 
P

Paul Lalli

hi
i have a piece of perl code like this

...
print "$globbed\n" ; # this output gives *.txt
process($globbed);

...

sub process {
my $pattern = $_[0];
while ( glob $pattern ) {
....

}

}
when the sub process is executed, i have an error> > " glob failed (child exited with status 1) "

thanks very much for any help rendered :)

What version of Perl? OS?
What if you change the while to a foreach?

Maybe this is relevant:
Is there a leak/bug in glob()?

I think the relevant entry from perldoc perldiag is more relevant:

glob failed (%s)
(W glob) Something went wrong with the external
program(s) used for "glob" and "<*.c>". Usually, this
means that you supplied a "glob" pattern that caused the
external program to fail and exit with a nonzero status.
If the message indicates that the abnormal exit resulted
in a coredump, this may also mean that your csh (C
shell) is broken. If so, you should change all of the
csh-related variables in config.sh: If you have tcsh,
make the variables refer to it as if it were csh (e.g.
"full_csh='/usr/bin/tcsh'"); otherwise, make them all
empty (except that "d_csh" should be "'undef'") so that
Perl will think csh is missing. In either case, after
editing config.sh, run "./Configure -S" and rebuild
Perl.

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top