Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Handler

Status
Not open for further replies.

kokarikomi

Programmer
Jun 10, 2004
3
IE
Hi,

I have encountered this problem lately but I don't know how to solve it.

my @filez=(file1,file2);
open(file1,">$path1");
open(file1,">$path2");

for (my $i=0 ; $i ; $i<$node_nb; $i++) {
$file=$filez[$i];
print $file "some data";
}

I have an error with the print $file ... which says 'Can't use string ("file1") as a symbol ref while "strict refs" in use'

Someone can help me with that?

Thank you,

R.
 
my @files = ("file1","file2");
or
my @files = qw(file1,file2);

---------------------------------------
If you helped... thx.
 
Actually I found the solution.
the way to write it is:

my @files=(*file1,*file2);

thxs anyway.

R.
 
np

---------------------------------------
If you helped... thx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top