in reply to Using a Variable Mutipule times(with different data)

Yes and no.

Yes, if you read in many different files, perform the same types of operations on them, but don't create a function to handle those manipulations. Or at least a loop. People who do this tend not to be diligent about error handling and tie themselves up in global variable failure knots.

# don't do this my @lines; open(DATA, ">file1"); while (<DATA>) { push @lines, $_; } process(@lines); open(DATA, ">file2"); @lines = <DATA> while (<DATA>) { push @lines, $_; } process(@lines);
This isn't a problem for filehandles, but what if the second open fails? What if process() doesn't remove everything from @lines? How long will you spend tracking down an error set by file #2 in a global variable that only shows up when you process file #10?

No, if you have a couple of functions that do different things but use lexical variables within the functions.

sub read_file { my $filename = shift; open (DATA, ">$filename") or return; # could die on error my @lines = <DATA>; return process(@lines); }
Besides that, if you keep using the same spot in memory over and over, you might cause that particular byte to fail prematurely. Better to spread things over the whole RAM stick.