[Chicago-talk] @ARGV while(<>)

Jay Strauss me at heyjay.com
Fri Jan 4 19:22:14 PST 2008


> Randal what does a single undef mean?  Does it mean only one file?
>
> should I do:
>
> @ARGV = qw($in_file);

Not to put words in Randal's mouth, but I believe he's refering to
your original post where you have:

@ARGV = $infile;

And $infile has no value, i.e. undefined (based on the original post).

[group] Is it just me, or does look funny to explicitly set @ARGV?

I believe it is better style to open a file handle upon $infile, and
do some error checking on the open.

Somthing along the lines of:

use strict;
use Carp;

my $infile = shift;
my $body;

open my $FILE, '<', $infile or croak "can\'t open file $infile: $!n";
while (<$FILE>) {
    unless(/epsf\[/) {
         $body = $body . $_;
    }
}


Jay


More information about the Chicago-talk mailing list