my %ref;
my $threelinefakein = "...\n...";
fillRef( \%ref, \$threelinefakein );
my @fakes = ( "1\n2\n3", "1\n2\n3" );
for my $fake ( @fakes ){
refLogic( \%ref, \$fake );
}
####
## Usage: fillRef( $hashref, $infilename );
sub fillRef {
## so you can keep using $ref{blah}
## less rewriting when you copy/paste
local *ref = shift;
## open the string as file
open IN, '<', shift;
...
}
## Usage: refLogic( $hashref, $infilename );
sub refLogic {
local *ref = shift;
## open the string as file
open IN, '<', shift;
## fake out for testing
local *OUT = \*STDOUT;
}
##
##
my %ref = ... ; ## Data::Dump::dd(%ref) output here
my @probes = ... ; ## Data::Dump::dd(@probes) output here
##
foreach my $key ( sort keys %ref ) {
#intended function
print OUT $ref{$key} . "\t" . $probes[$key];
#testing
my @temp = split "\t", $ref{$key};
foreach (@temp) {
if ( $temp[0] == 2 ) {
print $key. "\t" . $ref{$key} . "\t" . $probes[$key];
}
}
}
##
foreach my $key ( sort keys %ref ) {
print OUT $ref{$key} . "\t" . $probes[$key];
my @temp = split "\t", $ref{$key};
foreach (@temp) {
if ( $temp[0] == 2 ) { print $key. "\t" . $ref{$key} . "\n"; }
}
}