Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Why does the array not reset each time I call the function?

by wrinkles (Pilgrim)
on Apr 02, 2008 at 10:09 UTC ( #677927=note: print w/ replies, xml ) Need Help??


in reply to Why does the array not reset each time I call the function?

I do not understand why the variable @data_file keeps the data from the previous call.
The array is not keeping the data, your data file is keeping it. I believe that you are reading the the data from your file into @data_file here:
open(DATA, $dac03_location."/".$file) or die "Cannot open the file +!"; #Store the text in an array, easier to work with while(<DATA>){ chomp; push(@data_file,$_); } close(DATA);


Comment on Re: Why does the array not reset each time I call the function?
Download Code
Re^2: Why does the array not reset each time I call the function?
by tuxy94 (Initiate) on Apr 02, 2008 at 10:23 UTC
    Thanks, yes I am reading the data from my file to place it in @data_file. But by doing close(DATA); am I not clearing all what could have been saved in DATA?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (15)
As of 2014-12-26 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (172 votes), past polls