Re: inverting List::Compare



# get files
open(DAT, $lfile) or die("unable to open");

my @Llist = <DAT>;

close(DAT);

You should include the $! variable in the die string so that you know why the
open failed. I suggest

my @llist;
{
open my $fh, '<', $lfile or die "Unable to open '$lfile': $!";
@llist = <$fh>;
}

Am I right in thinking that the braces here perform two functions:

1) Limit the scope of $fh. As far as I can tell from the
documentation ( http://perldoc.perl.org/functions/close.html ), the
block should also contain an additional line expressly closing the
file handle. Like:
close $fh or die "Unable to close $lfile: $!\n";
If you want to automatically close filehandles as they go out of
scope, it looks like IO::File can do that (see
http://perldoc.perl.org/functions/open.html at the end of the page).
2) Improve readability - the purpose of these lines is to get values
into the array @llist, let's make it look that way.

Do I have that right?

Thanks,

John

--
sub japh{$_=$_[0];s/[$:]/$"/gs;chop;print $&
while/(.)/g;}print chr q:44:,$/ unless &japh
(qq=Just$/another$/Perl$/hacker$/=) && print
"Gosh, that JAPH you wrote just crashed!\n";
John Refior
jrefior@xxxxxxxxx
.