perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivan <ivan-...@420.am>
Subject Re: intermittent failure reading a file
Date Fri, 15 Jun 2001 19:27:48 GMT
On Fri, Jun 15, 2001 at 12:14:39PM -0700, Joshua Chamas wrote:
> Stephen Bardsley wrote:
> > 
> > my $wfname = 'a session based filename';
> > my $csv = Text::CSV->new();
> > my @fft = ();
> > my @line = ();
> > 
> > open(IN, "./fft <$wfname |") or die "could not open $wfname";
> > while (<IN>) {
> >   $csv->parse($_);
> >   @line = $csv->fields();
> >   push(@fft, $line[0]);
> > }
> > close(IN);
> > 
> 
> I don't know that while(<IN>) is a good idea,

It's a standard Perl construct and it works fine.

> I wonder what would happen if somehow a line
> was blank, would that be boolean 0 ?

Nope.  "Blank" lines contain a single \n, so they evaluate as true.
while (<FILEHANDLE>) is a pretty common perl construct.

>  Try 
> instead:  for(<IN>), or even
> 
>  my @lines = <IN>
>  for ( @lines ) {
> 
> -- Josh
> 
> _________________________________________________________________
> Joshua Chamas                           Chamas Enterprises Inc.
> NodeWorks <- Web Link Checking          Huntington Beach, CA  USA 
> http://www.nodeworks.com                1-714-625-4051
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
> 

-- 
meow
_ivan

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message