Handling array and creating list of required elements in perl
I have the code below:
This code gathers non required files like "KS""PUBLIC" and stores in hash
and in grep checks for it and throws out and give only required files like
A0, A1, B0, B1 to @MYFILES.
use warnings;
use strict;
my @myfiles = ("public", "A0", "A1", "B1", "B0", "KS");
my %goods = map { $_ => 1 } qw(public KS);
my @MYFILES = grep { not exists $bads{$_} } @myfiles;
Now, instead I want that from array @myfiles hash stores only required
files but on the basis of pattern matching and then store it in hash and
then give it to @MYFILES then how to do? ANy suggestion?
Here is what I mean like greping required field on the basis of alphabet
and digit and then storing in hash and then using that hash to provide
values to @MYFILES. That hash should include only A0, A1, B0, B1.
Thanks,
No comments:
Post a Comment