What you posted is incredibly hard to read and quite frankly you are a mean person for doing that. Bad person. No. No. Have you no decency?my @list = (@lines); foreach (@lines) { my @fields = split /,/; if ( $fields[2] eq '1' || $fields[2] eq '0' ) { #@arr1 = do {"@fields[4]\n"}; push @list, $fields[4]; @list = uniq @list; print "$_\n" for @list; @listx = "$_\n" for @list; print "LETING US SEE @listx"; } } @listx; my %ndmhash; my @listoffiles = ("CORP-INV-STAGE-NDM"); for (@listoffiles) { { my $file = "https://server8.kproxy.com/servlet/redirect.srv/slxv/sbuyazzgug/p1/tm +p/host/" . $_ . '.txt'; open( my $fh, '>', $file ) or die "Cannot open file '$file' for writing: $!"; my $name2 = $file; #$name2 =~ s/\CORP//g; #$name2 =~ s/*CORP-/ /g; $name2 =~ s/'$//; rename( $file, $name2 ); $ndmhash{$_} = $fh; } } my $pattern = join '|', @listoffiles; $pattern = qr/$pattern/; open my $fh1, '<', "/tmp/host/mon2a" or die "unable to open file 'file' for reading : $!"; while (<$fh1>) { chomp; my @fields = split( ',', $_ ); local $" = ','; if ( ( $fields[2] eq '1' || $fields[2] eq '0' ) && /$pattern/ ) { print { $ndmhash{ $fields[4] } } $fields[0], ',', $fields[32], + ',', $fields[6], "\n" if /MONTHLY/ && !/,-,/ && !/SM3/ && !/FISH/; print { $ndmhash{ $fields[4] } } $fields[0], ',', $fields[34], + ',', $fields[6], "\n" if /MONTHLY/ && !/,-,/ && /BASKET/; print { $ndmhash{ $fields[4] } } $fields[0], ',', $fields[35], + ',', $fields[6], "\n" if /MONTHLY/ && !/,-,/ && /FORM/; } } { close $ndmhash{$_} or die "Cannot close file '$_': $!"; }
In reply to Re: using an array in place of a file when calling a hash
by Anonymous Monk
in thread using an array in place of a file when calling a hash
by bigip2000
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |