On Tue, 30 Apr 2002, mukund wrote:

> In fact it had surprised me also.
> In my embperl script
> $stuff=<FILE>; #works
> but
> @stuff=<FILE>; # @stuff remains empty.
> 
> but then
> @stuff=<*FILE>;  #again works.

ok, but i've never faced these problems.  of course, all my code has 
variables predeclared, use strict, -w and error reporting on all calls.

my code would look like this:

#!/usr/bin/perl -w

use strict;
use Carp;

my $filename = "myfile.txt";

-e $filename or croak "$filename doesn't exist";
-r $filename or croak "$filename not readable by me";
open FILE, $filename or croak "Could not open $filname: $!";
my @stuff = <FILE> or carp "Nothing read from $filename";
close FILE or carp "Could not close $filename: $!";

...


_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to