RE: RE: if else question



> OK I get it now. I have made a few changes to your original,
> particular because I don't liek to use @ARGV with in a
> script. I also changes the way you store file, moving it into
> a hash structure so comparisons are much faster. Feel free to
> modifie as is.
>
> HTH,
> Mark G.
>
> #!PERL
>
> use warnings;
> use strict;
>
> open RD,"te.txt" or die "ERROR: $!\n";
> opendir RD_DIR, "." or die "ERROR: $!\n";;
>
> my @TMP = readdir RD_DIR or die "ERROR: $!\n";
> my %DIR_LIST;
>
> $DIR_LIST{$_}=1 for @TMP;
>
>
> foreach my $file ( <RD> ){
> chomp $file;
>
> unless( $DIR_LIST{$file} ){print STDERR "$file: NOFILE\n";next;}
>
> # do stuff here if matched
>}

Mark, thank you! I really need to work on understanding hashes, so this
will be a great start.

Thanks again!

Brian
.



Relevant Pages

  • Re: Getting array size
    ... Mark wrote: ... > sizeofis always 4 no matter what. ... sizeof() is evaluated at compile time, and argv is a POINTER, which on win32 is ...
    (microsoft.public.vc.language)
  • Re: accessing args via command line
    ... mark wrote: ... > Not giving the argument via command line and trying to access it ... int main(int argc, char* argv[]) ...
    (comp.lang.cpp)