Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Strange behaviour when using glob in if condition

by vrk (Chaplain)
on Apr 11, 2017 at 13:55 UTC ( #1187644=note: print w/replies, xml ) Need Help??


in reply to Strange behaviour when using glob in if condition

Is it just a difference between scalar and list context? See the glob help: In list context (like my @files = glob(...)), you get a list of filenames, or the empty list if nothing matches. In scalar context, you get an iterator. When you evaluate the iterator, it yields the next matching filename, or undef when it reaches the end. Since your code works correctly when glob is in list context, maybe some of the glob calls in scalar context actually share an iterator?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1187644]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2023-02-05 14:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (31 votes). Check out past polls.

    Notices?