I have a file with 5 columns and want to use the data in the file to define a hash with key-value pair as shown below:
key - c1, c2, c3
value - c1, c2, c3, c4, c5
However, %myHash is empty. What needs to be done differently?
Thanks,
MW
key - c1, c2, c3
value - c1, c2, c3, c4, c5
Code:
my(%myHash);
my ($c1, $c2, $c3, $c4, $c5);
open(IN,"file1")
while(my $current = <IN>)
{
$current =~ /^(($c1\t$c2\t$c3)\t$c4\t$c5)/;
$myHash{$2} = $1;
}
print %myHash;
However, %myHash is empty. What needs to be done differently?
Thanks,
MW