Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Glob error check giving warning

by ysth (Canon)
on Dec 05, 2010 at 08:38 UTC ( #875468=note: print w/ replies, xml ) Need Help??


in reply to Glob error check giving warning

By and large, don't use glob() in scalar context. The next time your program executes that line, it will provide the next *.ntp file from the original directory, even if $dir has changed, and after getting each *.ntp file, it will return undef once before restarting. Try this instead.

if ( ! defined( $file ) ) { $file = ( glob(...) )[0]; if ( ! defined( $file ) ) { die "no NTP file\n"; } }
--
A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |
Online Fortune Cookie Search
Office Space merchandise


Comment on Re: Glob error check giving warning
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2014-10-22 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (112 votes), past polls