develooper Front page | perl.perl5.porters | Postings from August 2008

Re: [perl #58116] glob("~user") works every 2nd time

Thread Previous
Paul Johnson
August 20, 2008 02:40
Re: [perl #58116] glob("~user") works every 2nd time
Message ID:
On Tue, Aug 19, 2008 at 07:49:10AM -0700, Ulrich Windl wrote:
> I have written some code that works when called the first time, and from
> then on it seems it only works every 2nd time.
> That code (from a subroutine) is:
>     $homedir = glob("~ora\L$ORA_SID\E");
>     Log(0, 'E', 'logger', "~ora\L$ORA_SID\E: $!")
> 	unless ($homedir);

This is working as designed.  Please reread "perldoc -f glob" and note
that you are calling glob in scalar context.

Perhaps you wanted
      ($homedir) = glob("~ora\L$ORA_SID\E");
to call glob in list context?

Paul Johnson -

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About