Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Perl Script Causing high CPU usage

by marinersk (Priest)
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056225]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2017-04-28 06:49 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (519 votes). Check out past polls.