Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Perl Script Causing high CPU usage

by marinersk (Curate)
on Sep 29, 2013 at 14:51 UTC ( #1056225=note: print w/ replies, xml ) Need Help??

in reply to Perl Script Causing high CPU usage

In my early days in Perl on Windows, glob behaved in some undesireable fashion -- I no longer remember what the problems were.

You might try to isolate whether glob is causing the high CPU utilization -- I suspect it is NOT, but worth checking. You can replace glob with something like this:

# ... Create a regular expression to represent the wildcard string nor +mally submitted to glob my $MatchPatternRegex = "ABC\\_XYZ\\_.{9}\\.xml"; if (opendir CURDIR, $directoryName) { my $nextFilename = readdir CURDIR; while ($nextFilename) { if ($nextFilename =~ /$MatchPatternRegex/) { # ... Do your stuff here } } closedir CURDIR; }
If using this instead of glob eliminates your CPU problem, you know something new about your environment, and perhaps you'll want to craft around glob. If this does not change the behavior, you've ruled out glob as the problem, which could be useful information as you troubleshoot this.

Comment on Re: Perl Script Causing high CPU usage
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2015-11-30 00:51 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (755 votes), past polls