RE: RE: if else question
- From: BVolk@xxxxxxxxxxxxxx (Brian Volk)
- Date: Thu, 28 Apr 2005 15:30:43 -0500
> 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
.
- Prev by Date: Re: perl module to create pdf reports
- Next by Date: Re: perl module to create pdf reports
- Previous by thread: Re: RE: if else question
- Next by thread: perl module to create pdf reports
- Index(es):
Relevant Pages
|