Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Reference is experimental

by davido (Cardinal)
on Oct 20, 2016 at 15:35 UTC ( [id://1174383]=note: print w/replies, xml ) Need Help??


in reply to Reference is experimental

Certainly by now you've discovered it, but you have an additional bug:

while (@ARGV){

Since nothing is ever shifted off of @ARGV, the loop will continue almost forever. $counter will increment past the last element in @ARGV, so $filename will start being undef after a few iterations, but you aren't checking the return value of open to ever know that you're failing to open files. Meanwhile you'll keep pushing empty arrayrefs onto @AoA until the system bogs down under the burden of the memory leak.

After fixing that consider also using the 3-arg version of open, and checking for open success.


Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-03-28 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found