vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:
use Data::Dumper; my @files = ("ree", "ree1", "ree2"); print "Files: " . join(" ", @files) . "\n"; print Dumper \@files; foreach(@files) { print "The file is $_\n"; func(); } sub func { open(READ, "< test.txt"); while(<READ>) { # print; } close READ; return; } print "Files: " . join(" ", @files) . "\n";
The above produces the
Files: ree ree1 ree2
The file is ree
The file is ree1
The file is ree2
Files:
But I expected the result should be
Files: ree ree1 ree2
The file is ree
The file is ree1
The file is ree2
Files: ree ree1 ree2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array element getting deleted
by Corion (Patriarch) on Apr 17, 2009 at 11:48 UTC | |
by Bloodnok (Vicar) on Apr 17, 2009 at 11:59 UTC | |
|
Re: Array element getting deleted
by targetsmart (Curate) on Apr 17, 2009 at 11:49 UTC | |
by eelkonio (Initiate) on Apr 17, 2009 at 14:05 UTC | |
|
Re: Array element getting deleted
by ELISHEVA (Prior) on Apr 17, 2009 at 14:16 UTC | |
by ack (Deacon) on Apr 17, 2009 at 18:13 UTC | |
|
Re: Array element getting deleted
by dHarry (Abbot) on Apr 17, 2009 at 11:48 UTC | |
by ww (Archbishop) on Apr 17, 2009 at 12:33 UTC | |
|
Re: Array element getting deleted
by AnomalousMonk (Archbishop) on Apr 17, 2009 at 19:16 UTC | |
|
Re: Array element getting deleted
by Anonymous Monk on Apr 22, 2009 at 10:18 UTC |