Hi all,
Why can't I use a subscript in the angle brackets? e.g.
@files=`ls /app2/koekemtn/scripts/dbstats/test`;
chomp $files[0];
open ( $files[0] , $files[0]) || die Cannot open $files[0]\n;
while ($files[0]) {
print $_;
}
TIA
Tielman Koekemoer (TNE) wrote:
Hi all,
Hello,
Why can't I use a subscript in the angle brackets? e.g.
@files=`ls /app2/koekemtn/scripts/dbstats/test`;
chomp $files[0];
open ( $files[0] , $files[0]) || die Cannot open $files[0]\n;
while ($files[0]) {
print $_;
}
perldoc perlop
Thanks for the help. So I cannot use an array or hash in angle
brackets as file handle. I have a variable amount of files which I'd
like opened and the contents shuffled. What would be the best way to
do this as my next idea also did not work?
_BEGIN_
@files=`ls
Tielman Koekemoer (TNE) [TK], on Wednesday, May 25, 2005 at 10:32
(+0200) typed the following:
TK $file$num = $line; # Problem assignment!
use hash instead scalar variables; $file{$num} is OK.
First you have to ofcourse declare it: my %file = ();
--
How do you protect mail on web? I
On May 25, 2005, at 10:32, Tielman Koekemoer ((TNE)) wrote:
Thanks for the help. So I cannot use an array or hash in angle
brackets as file handle. I have a variable amount of files which I'd
like opened and the contents shuffled. What would be the best way to
do this as my next idea also did
Hi,
Tielman Koekemoer (TNE) [EMAIL PROTECTED] asked:
Thanks for the help. So I cannot use an array or hash in
angle brackets as file handle. I have a variable amount of
files which I'd like opened and the contents shuffled. What
would be the best way to do this as my next idea also did
On May 25, Tielman Koekemoer (TNE) said:
Thanks for the help. So I cannot use an array or hash in angle
brackets as file handle. I have a variable amount of files which I'd
like opened and the contents shuffled. What would be the best way to
do this as my next idea also did not work?
foreach my $file ( @ARGV ){
if( my $fh = new IO::File $file ){
# Be explicit[1]
if (my $fh = IO::File-new($file)) {
push @infh, $fh;
} else {
die Failed to open input file '$file': $!;
}
}
[1] http://www.perl.com/doc/manual/html/pod/perlobj.html#WARNING
--
To unsubscribe,